Ejemplo n.º 1
0
    def getGameEnded(self, board, player, turn, end_Evaluate=False):
        """
        Input:
            board: cannoical board
            player: int, 1 = white, -1 = black
            turn: [0.......23] = 24 turns in total = for i in range(0,24)
        return:
            0 nothing
            1 player Won
            -1 player Lost
        """
        if turn < 24:
            return 0
        else:
            if end_Evaluate:
                print("Start Board:\n%s" % (np.array(board).reshape(8, 8)))
                result = endEvaluator.playGame(board)
                return result
            else:
                b = Board(self.n)
                b.pieces = np.copy(board)
                if b.countDiff(player) > 0:
                    return 1
                elif b.countDiff == 0:
                    return 1e-4  #tie condiitiion

                return -1
Ejemplo n.º 2
0
 def getScore(self, board, player):
     """
     Input:
         board: np array
         player: WHITE BLACK
     return:
         score of player
     """
     b = Board(self.n)
     b.pieces = np.copy(board)
     return b.countDiff(player)
Ejemplo n.º 3
0
    def getGameEnded(self, board, player, turn):
        """
        Input:
            board: cannoical board
            player: int, 1 = white, -1 = black
            turn: [0.......23] = 24 turns in total = for i in range(0,24)
        return:
            0 nothing
            1 player Won
            -1 player Lost
        """
        b = Board(self.n)
        b.pieces = np.copy(board)
        if turn < 24:  #4: for adding turn parameter
            return 0
        else:
            if b.countDiff(player) > 0:
                return 1
            elif b.countDiff == 0:
                return 1e-4  #tie condiitiion

        return -1