comparison gamelib/eegg.py @ 592:441077fab928

Easter egg.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 28 Nov 2009 23:37:10 +0000
parents
children
comparison
equal deleted inserted replaced
590:066b85a7f1cf 592:441077fab928
1 import datetime
2
3 def calc_eggday(y):
4 g = y % 19
5 e = 0
6 c = y/100
7 h = (c-c/4-(8*c+13)/25+19*g+15)%30
8 i = h-(h/28)*(1-(h/28)*(29/(h+1))*((21-g)/11))
9 j = (y+y/4+i+2-c+c/4)%7
10 p = i-j+e
11 d = 1+(p+27+(p+6)/40)%31
12 m = 3+(p+26)/30
13 return datetime.date(y,m,d)
14
15 def is_eggday():
16 today = datetime.date.today()
17 return today == calc_eggday(today.year)