예제 #1
0
    private int ScoreUnfinishedBoard(BoardData p_board, Tiles p_currentPlayerTile)
    {
        // If there is an enemy check then this board is shitty
        if (p_board.GetMoveToWin(p_board.CurrentPlayer).Count > 0)
        {
            return(0);
        }

        int t_currentPlayerChecks = p_board.GetMoveToWin(p_board.CurrentPlayer ^ (Players)1).Count;

        if (t_currentPlayerChecks >= 2)
        {
            return((int)BoardScores.TERMINAL);
        }
        else
        {
            int t_ghostChecks = p_board.CountGhostChecks(p_currentPlayerTile);
            if (t_ghostChecks == 3)
            {
                return((int)BoardScores.TRIPLETRAP);
            }
            else if (t_ghostChecks == 2)
            {
                if (t_currentPlayerChecks > 0)
                {
                    return((int)BoardScores.EASYTRAP);
                }
                else
                {
                    return((int)BoardScores.DOUBLETRAP);
                }
            }
            else
            {
                if (t_currentPlayerChecks > 0)
                {
                    return((int)BoardScores.CHECK);
                }
                else if (p_board.IsCornerTile(p_currentPlayerTile))
                {
                    return((int)BoardScores.CORNER);
                }
                else
                {
                    return(0);
                }
            }
        }
    }