def __init__(self):
import random
doors = {
0: Door(1),
1: Door(2),
2: Door(3)}
# random.randrange(startInt,endInt) generates a random integer in the range
# of startInt (which is included in the possibilities) to endInt (which is
# not included in the possibilities.
prize_door = random.randrange(0,3)
doors[prize_door].contents = "prize"
doors[((prize_door + 1) % 3)].contents = "goat"
doors[((prize_door + 2) % 3)].contents = "goat"
self.keep_track = {"doors": doors,
"prize": doors[prize_door],
"selected": None,
"opened": None}
评论列表
文章目录