From cf5b9ed3d6539e5afda57070625d8f5404faaa1b Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Fri, 20 May 2011 08:30:33 +0200 Subject: host/simu/model/table_eurobot2011: each card can be drawn only once --- host/simu/model/table_eurobot2011.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/host/simu/model/table_eurobot2011.py b/host/simu/model/table_eurobot2011.py index f4bb63b7..f200028e 100644 --- a/host/simu/model/table_eurobot2011.py +++ b/host/simu/model/table_eurobot2011.py @@ -31,8 +31,11 @@ class Table (simu.model.table.Table): def __init__ (self, cards = None): simu.model.table.Table.__init__ (self) # Draw cards. - if cards is None: - cards = [ randrange (20) for i in xrange (3) ] + cards = [ ] + while len (cards) != 3: + card = randrange (20) + if card not in cards: + cards.append (card) self.cards = cards def pos (card): king_pos = card // 4 -- cgit v1.2.3