Mercurial > sypikslang
changeset 26:5d699b1f7188
Better REPL game.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 06 May 2012 19:24:52 +0200 |
parents | 27570aca5d17 |
children | 4d9610c59efa |
files | gamelib/tests/repl_game.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/tests/repl_game.py Sun May 06 19:21:06 2012 +0200 +++ b/gamelib/tests/repl_game.py Sun May 06 19:24:52 2012 +0200 @@ -11,14 +11,20 @@ self.display_state() def display_state(self): - print "Game:", self.game + print "Points:", self.game.points print "Science:" + self.science = [] for science in self.game.lab.science: - print " %s %s (%s)" % ( - "*" if science.can_spend(self.game.lab) else "-", - science.NAME, science.points) + if science.can_spend(self.game.lab): + self.science.append(science) + print " %s. %s (%s)" % ( + len(self.science), science.NAME, science.points) + else: + print " -- %s (%s)" % (science.NAME, science.points) def next_turn(self, research_list, missions): + assert not missions, "Missions not currently supported." + research_list = [self.science[i - 1] for i in research_list] self.game.cur_allocation.extend(research_list) self.game.cur_missions.extend(missions) self.game.end_turn()