-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclock.py
More file actions
58 lines (44 loc) · 1.36 KB
/
clock.py
File metadata and controls
58 lines (44 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
## from Singleton import Singleton
#having lots of problems with singleton class
#can't use functions that should work.. gives attributeErrors saying
#singleton instance has no attribute ____
#going to use a regular class instead
class Season:
SPRING = 1
SUMMER = 2
FALL = 3
WINTER = 4
##@Singleton
class Time(object):
def __init__(self, day, season, year):
self.day = day
self.season = season
self.year = year
def checkClock(self):
return (str(gameTime.seasonFriendly()), str(self.day), str(self.year))
#moves time forward! ^_^
def advanceDay(self):
self.count = 0
if self.day < 30:
self.day += 1
elif self.season < Season.WINTER:
self.day = 1
self.season += 1
else:
self.day = 1
self.season = 1
self.year += 1
print ("")
print ("It's a new day!")
gameTime.checkClock()
#returns the season to be printed
def seasonFriendly(self):
if self.season == Season.SPRING:
return "Spring"
elif self.season == Season.SUMMER:
return "Summer"
elif self.season == Season.FALL:
return "Fall"
elif self.season == Season.WINTER:
return "Winter"
gameTime = Time(1, Season.SPRING, 1)