Example #1
0
 def move(self, state, rounds):
     if self.type.lower() == 'human':
         print("{0}'s turn.  {0} is {1}".format(self.name, self.color))
         column = None
         while column == None:
             try:
                 choice = int(input("Enter a move (1-7): ")) - 1
             except ValueError:
                 choice = None
             if 0 <= choice <= 6:
                 column = choice
             else:
                 print("Invalid choice, try again")
         return column
     else:
         print("{0}'s turn.  {0} is {1}".format(self.name, self.color))
         #return random.randint(0, 6)
         m = Minimax(state)
         best_alpha, alpha = m.findColumn(self.difficulty, state, self.color, rounds)
         return best_alpha