Created
July 2, 2012 10:43
-
-
Save markbeaton/3032615 to your computer and use it in GitHub Desktop.
Most ridiculous code ever.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rules... | |
// All game is allowed to be hunted from 30 minutes before the sunrise to 30 minutes after | |
// sunset in the respective time zone when in season. | |
// EXCEPT DUCKS! | |
// Hunting hours for ducks: | |
// a. Opening times for the first day of the season is different for the time zones. East | |
// of longitude 146 30’ east, the season will open at 7:10 am, between 146 30’ east and | |
// 142 30’ east, the season will open at 7:20 am, lastly west of longitude 142 30’, the | |
// season will open at 7:30 am. | |
// b. For the rest of the season, duck hunting is allowed 30 minutes before the respective | |
// sun rise times. | |
// c. Duck hunting ends 30 minutes after sunset of the respective region. | |
// First, see if the time of the supplied date is within the allowed hunt times for that date | |
NSUInteger huntTimeStart = [DPIUtilities minutesUntilSunriseOnDate:date forLocation:coordinate] - 30; | |
NSUInteger huntTimeEnd = [DPIUtilities minutesUntilSunsetOnDate:date forLocation:coordinate] + 30; | |
if (species == SpeciesDuck && [self isDuckSeasonStartDate:date]) | |
{ | |
// It's the start of duck-hunting season! | |
huntTimeStart = (7 * 60); | |
if (coordinate.longitude > 146.5) | |
huntTimeStart += 10; | |
else if (coordinate.longitude >= 142.5 && coordinate.longitude <= 146.5) | |
huntTimeStart += 20; | |
else if (coordinate.longitude < 142.5) | |
huntTimeStart += 30; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment