summaryrefslogtreecommitdiff
path: root/host/simu/model
diff options
context:
space:
mode:
authorNicolas Schodet2011-05-20 08:30:33 +0200
committerNicolas Schodet2011-05-20 08:30:33 +0200
commitcf5b9ed3d6539e5afda57070625d8f5404faaa1b (patch)
tree3e92c4497aab764019ea616cc271b53356c49fea /host/simu/model
parent2277c9a7aa41c347ba04fca8e202c77b43618802 (diff)
host/simu/model/table_eurobot2011: each card can be drawn only once
Diffstat (limited to 'host/simu/model')
-rw-r--r--host/simu/model/table_eurobot2011.py7
1 files 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