Write a program that takes a birth date (month and day-of-month) as input and outputs the corresponding sign, element and quality of the western zodiac. For the purposes of this challenge, these are defined exactly as in the table in the linked wikipedia page:
Sign Date Range Element Quality Aries March 21 to April 19 Fire Cardinal Taurus April 20 to May 20 Earth Fixed Gemini May 21 to June 21 Air Mutable Cancer June 22 to July 22 Water Cardinal Leo July 23 to August 22 Fire Fixed Virgo August 23 to September 22 Earth Mutable Libra September 23 to October 23 Air Cardinal Scorpio October 24 to November 20 Water Fixed Sagittarius November 21 to December 22 Fire Mutable Capricorn December 23 to January 20 Earth Cardinal Aquarius January 21 to February 21 Air Fixed Pisces February 22 to March 20 Water Mutable
- The sign, element and quality will be calculated from the input date exactly according to the wikipedia table.
- I am giving some freedom over input date format (see Input section below). You must clearly state in your answer what format you are using.
- If an invalid date is provided (unparsable date, or month or day-of-month out of range), the program will exit with the message
- The program must correctly handle leap years. i.e. if Feb 29th is the input, then output must correctly be
Pisces, Water, Mutable.
- Your language's Date libraries/APIs are allowed, but any APIs that specifically calculate signs of the zodiac are banned.
- Standard “loopholes” which are no longer funny
- This is code-golf, so the shortest answer in bytes wins.
- The program may read the input date from STDIN, command-line, environment variables or whatever method is convenient for your language of choice.
- This is not primarily an exercise in datestring-parsing, so the input string may be provided in whatever format you choose, as long as it consists of only month and day-of-month components and not other values (such as year or time). E.g.
24th of Julyor
24/07or whatever format is convenient. If input not matching your choice of input format is entered, then the
Invalid dateerror must be thrown.
- The program will output to STDOUT, dialog box or whatever display method is convenient for your language of choice.
- The output format will be the sign, element and quality separated by a comma and a space:
Sign, Element, Quality
Input Output 1/1 Capricorn, Earth, Cardinal 2/29 Pisces, Water, Mutable 7/24 Leo, Fire, Fixed 13/1 Invalid date 2/31 Invalid date -1/-1 Invalid date 1st of Golfember Invalid date