"""Return the selected territory
"""
free_territories = [t for t in world.territories() if t.player == None]
- return random.sample(free_territories, 1)[0]
+ return random.sample(free_territories, 1)[0].name
def play_cards(self, world, log, play_required=True):
"""Decide whether or not to turn in a set of cards.
for p in self.players:
p.alive = True
random.shuffle(self.players)
- deck.shuffle()
+ self.deck.shuffle()
self.select_territories()
self.place_initial_armies()
for p in self.players:
t.player = None
for i in range(len(list(self.world.territories()))):
p = self.players[i % len(self.players)]
- t = p.select_territory(self.world, self.log)
+ t_name = p.select_territory(self.world, self.log)
+ t = self.world.territory_by_name(t_name)
if t.player != None:
raise PlayerError('Cannot select %s owned by %s'
% (t, t.player))