code: def move(self, state):
          
          if state == tuple([ BEGIN ] * self.state_size):
              choices = self.begin_choices
              cumdist = self.begin_cumdist
          else:
              choices, weights = zip(*self.model[state].items())
              cumdist = list(accumulate(weights))
          r = random.random() * cumdist[-1]
          selection = choices[bisect.bisect(cumdist, r)]
          return selection
docs: Given a state, choose the next item at random.