moved make_tamagotchi_list to Util
This commit is contained in:
1
cli.py
1
cli.py
@@ -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:
|
||||
|
||||
@@ -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
16
test.py
@@ -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
|
||||
|
||||
6
util.py
6
util.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user