-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetting.py
More file actions
35 lines (30 loc) · 1.06 KB
/
Setting.py
File metadata and controls
35 lines (30 loc) · 1.06 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
#===========================================================================
# Description: Settings for a game
#
# State Attributes
# settings - Dictionary - the various parameter settings for a game
#
# Methods
# setSetting(name, initValue) - creates or modifies a setting of the given name and value
# getValue(name) - returns the value of the
# settingIs(name, value) - returns True if setting of given name is the value
# if setting doesn't exist, it returns False
#===========================================================================
class Setting:
def __init__(self):
'''
Constructor
'''
self.settings = {}
def setSetting(self, name, initValue):
self.settings[name] = initValue
def getValue(self, name):
if name in self.settings:
return self.settings[name]
else:
return None
def settingIs(self, name, value):
if name in self.settings:
return self.settings[name] == value
else:
return False