Mercurial > sypikslang
comparison gamelib/tests/repl_game.py @ 26:5d699b1f7188
Better REPL game.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 06 May 2012 19:24:52 +0200 |
parents | f6a3b213857b |
children | 2f7d8f908de0 |
comparison
equal
deleted
inserted
replaced
25:27570aca5d17 | 26:5d699b1f7188 |
---|---|
9 def _begin_turn(self): | 9 def _begin_turn(self): |
10 self.game.start_turn() | 10 self.game.start_turn() |
11 self.display_state() | 11 self.display_state() |
12 | 12 |
13 def display_state(self): | 13 def display_state(self): |
14 print "Game:", self.game | 14 print "Points:", self.game.points |
15 print "Science:" | 15 print "Science:" |
16 self.science = [] | |
16 for science in self.game.lab.science: | 17 for science in self.game.lab.science: |
17 print " %s %s (%s)" % ( | 18 if science.can_spend(self.game.lab): |
18 "*" if science.can_spend(self.game.lab) else "-", | 19 self.science.append(science) |
19 science.NAME, science.points) | 20 print " %s. %s (%s)" % ( |
21 len(self.science), science.NAME, science.points) | |
22 else: | |
23 print " -- %s (%s)" % (science.NAME, science.points) | |
20 | 24 |
21 def next_turn(self, research_list, missions): | 25 def next_turn(self, research_list, missions): |
26 assert not missions, "Missions not currently supported." | |
27 research_list = [self.science[i - 1] for i in research_list] | |
22 self.game.cur_allocation.extend(research_list) | 28 self.game.cur_allocation.extend(research_list) |
23 self.game.cur_missions.extend(missions) | 29 self.game.cur_missions.extend(missions) |
24 self.game.end_turn() | 30 self.game.end_turn() |
25 self._begin_turn() | 31 self._begin_turn() |