Update code organization

pull/1/head
Jake Funke 2017-03-06 23:29:23 +00:00
parent 718f64f90d
commit a355457c75
1 changed files with 12 additions and 7 deletions

View File

@ -52,10 +52,9 @@ class Plant:
0: 'seed', 0: 'seed',
1: 'seedling', 1: 'seedling',
2: 'young', 2: 'young',
3: 'grown', 3: 'mature',
4: 'mature', 4: 'flowering',
5: 'flowering', 5: 'fruiting',
6: 'fruiting',
} }
color_dict = { color_dict = {
@ -87,6 +86,7 @@ class Plant:
3: 'venus flytrap', 3: 'venus flytrap',
4: 'cherry tree', 4: 'cherry tree',
5: 'fern', 5: 'fern',
6: 'daffodil',
} }
mutation_dict = { mutation_dict = {
@ -94,7 +94,12 @@ class Plant:
1: 'humming', 1: 'humming',
2: 'noxious', 2: 'noxious',
3: 'vorpal', 3: 'vorpal',
4: 'glowing' 4: 'glowing',
5: 'electric',
6: 'freezing',
7: 'flaming',
8: 'psychic',
9: 'screaming'
} }
def __init__(self): def __init__(self):
@ -135,7 +140,7 @@ class Plant:
return rarity return rarity
def growth(self): def growth(self):
if self.stage < 7: if self.stage < len(self.stage_dict):
self.stage += 1 self.stage += 1
# do stage growth stuff # do stage growth stuff
CONST_MUTATION_RARITY = 9 # Increase this # to make mutation rarer (chance 1 out of x) CONST_MUTATION_RARITY = 9 # Increase this # to make mutation rarer (chance 1 out of x)
@ -156,7 +161,7 @@ class Plant:
if __name__ == '__main__': if __name__ == '__main__':
my_plant = Plant() my_plant = Plant()
print my_plant.stage, my_plant.species, my_plant.color, my_plant.rarity, my_plant.mutation print my_plant.stage, my_plant.species, my_plant.color, my_plant.rarity, my_plant.mutation
while my_plant.stage < 7: while my_plant.stage < len(my_plant.stage_dict):
raw_input("...") raw_input("...")
my_plant.parse_plant() my_plant.parse_plant()
my_plant.growth() my_plant.growth()