- commit
- 331d7d6eac5ada18e07759077d6b16a8ff459e65
- parent
- c389d3ce1bb6eb1dde4b9113b21bb14d460c7bc3
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2014-05-25 21:00
make less default parameters
Diffstat
| M | DEATH/DeathCliMenu.py | 7 | ++++--- |
| M | DEATH/death.py | 2 | +- |
| M | DEATH/death_ui.py | 35 | ++++++++++++++++++----------------- |
3 files changed, 23 insertions, 21 deletions
diff --git a/DEATH/DeathCliMenu.py b/DEATH/DeathCliMenu.py
@@ -32,7 +32,7 @@ return with any key 32 32 33 33 34 34 class Crs(object):35 -1 def __init__(self, screen=curses.initscr()):-1 35 def __init__(self, screen): 36 36 self.screen = screen 37 37 self.screen.clear() 38 38 curses.curs_set(0) @@ -175,13 +175,14 @@ class Crs(object): 175 175 176 176 _map = Map(rows, cols) 177 177 d = Death(_map, n, alive, born, kill)178 -1 DeathUI(d, 'default', self.screen)-1 178 DeathUI(self.screen, d, title='default') 179 179 return True 180 180 181 181 182 182 if __name__ == '__main__': -1 183 screen = curses.initscr() 183 184 try:184 -1 Crs()-1 185 Crs(screen) 185 186 except Exception as ex: 186 187 print(ex) 187 188 curses.endwin()
diff --git a/DEATH/death.py b/DEATH/death.py
@@ -20,7 +20,7 @@ from matrix import Map 20 20 21 21 22 22 class Death(object):23 -1 def __init__(self, _map=Map(), n=1, alive=[[2, 3]], born=[[3]], kill=[[]],-1 23 def __init__(self, _map, n=1, alive=[[2, 3]], born=[[3]], kill=[[]], 24 24 win=lambda _map, n: None): 25 25 # the defaults make death the standart life 26 26 self.n = n
diff --git a/DEATH/death_ui.py b/DEATH/death_ui.py
@@ -33,22 +33,8 @@ return with any key 33 33 """ 34 34 35 3536 -1 def example_game(rows=15, cols=15, n=2):37 -1 map = Map(rows, cols)38 -1 alive = []39 -1 born = []40 -1 kill = []41 -1 for player in range(n):42 -1 alive.append(abk.conway[0])43 -1 born.append(abk.conway[1])44 -1 kill.append(abk.conway[2])45 -1 death = Death(map, n, alive, born, kill, win.economy)46 -1 return death47 -148 -149 36 class DeathUI(object):50 -1 def __init__(self, death=example_game(15, 15, 2), title='',51 -1 screen=curses.initscr()):-1 37 def __init__(self, screen, death, title=''): 52 38 self.screen = screen 53 39 self.death = death 54 40 self.title = title @@ -140,9 +126,24 @@ class DeathUI(object): 140 126 return True 141 127 142 128143 -1 if __name__ == '__main__':-1 129 def main(): -1 130 screen = curses.initscr() -1 131 map = Map(rows, cols) -1 132 alive = [] -1 133 born = [] -1 134 kill = [] -1 135 for player in range(n): -1 136 alive.append(abk.conway[0]) -1 137 born.append(abk.conway[1]) -1 138 kill.append(abk.conway[2]) -1 139 death = Death(map, n, alive, born, kill, win.economy) -1 140 144 141 try:145 -1 DeathUI()-1 142 DeathUI(screen, death) 146 143 except Exception as ex: 147 144 print(ex) 148 145 curses.endwin() -1 146 -1 147 -1 148 if __name__ == '__main__': -1 149 main()