moved make_tamagotchi_list to Util

This commit is contained in:
luxick
2015-08-26 15:37:59 +02:00
parent 7186918752
commit 9862998242
4 changed files with 13 additions and 14 deletions

1
cli.py
View File

@@ -30,7 +30,6 @@ class cursesUI:
def build_screen(self, king, ticks):
height, width = self.stdscr.getmaxyx()
self.win.move(0, 0)
self.win.addstr(0, 0, 'Tamagotchi Colony (alpha) - currently at tick '+str(ticks)+'.')
if self.kingdomview:

View File

@@ -28,5 +28,5 @@ max_workpower = 6
# This defines the bounds of how much a Tamagotchi can recover when eating/sleeping/playing etc.
min_recovery = 10
max_recovery = 20
# Define if simulation should be started paused or running
start_paused = False

16
test.py
View File

@@ -11,24 +11,18 @@ import curses
# Temporary test section
ticks = 0
def make_list(number):
tmp = []
for n in range(0,number):
tmp.append(Util().make_Tamagotchi())
return tmp
king = Kinggotchi()
for n in range(0, 30):
king.add_village(Mayorgotchi(make_list(startnr)))
ui = cursesUI(True)
for n in range(0, 30):
king.add_village(Mayorgotchi(Util().make_list_of_Tamagotchis(startnr)))
while True:
ui.build_screen(king,ticks)
ui.build_screen(king, ticks)
if not ui.paused:
king.step()
ticks += 1
if not ui.running:
break

View File

@@ -20,3 +20,9 @@ class Util:
recovery = random.randrange(min_recovery, max_recovery, 1)
return Tamagotchi(name,hunger,happiness,hygiene,sleep,decayspeed,potential,recovery)
def make_list_of_Tamagotchis(self, number):
tmp = []
for n in range(0,number):
tmp.append(self.make_Tamagotchi())
return tmp