Exemplo n.º 1
0
 def get_placement(self, board, piece, pieces):
     if self.change > (16-len(pieces)):
         #return super(MinimaxPlayer, self).get_placement(board, piece, pieces)
         return NovicePlayer.get_placement(self, board, piece, pieces)
     else:
         won, pos = NovicePlayer.has_winning_pos(self, board, piece)
         if won:
             self.placePiece = None #Done because games ask for a valid pices even if
                                     #this was a victory
             return pos
         pos, next = minimax(piece.val, board.get_board(), self.plys)
         self.placePiece = Piece(val=next) if 0 <= next < 16 else None
         return pos
Exemplo n.º 2
0
 def get_placement(self, board, piece, pieces):
     if self.change > (16 - len(pieces)):
         #return super(MinimaxPlayer, self).get_placement(board, piece, pieces)
         return NovicePlayer.get_placement(self, board, piece, pieces)
     else:
         won, pos = NovicePlayer.has_winning_pos(self, board, piece)
         if won:
             self.placePiece = None  #Done because games ask for a valid pices even if
             #this was a victory
             return pos
         pos, next = minimax(piece.val, board.get_board(), self.plys)
         self.placePiece = Piece(val=next) if 0 <= next < 16 else None
         return pos