5 self._shutable = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
12 self._diced = [random.randint(1, 6), random.randint(1, 6)]
14 for rods in [ self._diced,
15 [ abs(self._diced[0] - self._diced[1]) ],
16 [ self._diced[0] + self._diced[1] ] ]:
17 if self._can_be_shut(rods):
18 self._options.append(rods)
23 def get_shutable(self):
26 def get_options(self):
30 if self._is_valid_option(rods):
33 self._shutable.remove(rod)
38 return len(self._shutable) == 0 or \
39 ( self._diced and len(self._options) == 0 )
44 def _can_be_shut(self, rods):
45 shutable = self._shutable.copy()
53 def _is_valid_option(self, rods):
54 for option in self._options:
55 if set(option) == set(rods):