Beispiel #1
0
    private void CheckWin()
    {
        int result = boardGrid.CheckWinner();

        switch (result)
        {
        case -1:
            NextMove();
            break;

        case 0:
            draws++;
            Draw(draws);
            break;

        case 1:
        case 2:
            winnerSign = result;
            if (playerSign == result)
            {
                wins++;
                Win(wins);
            }
            else
            {
                losses++;
                Loss(losses);
            }
            break;
        }
    }
Beispiel #2
0
    private static int Evaluate(BoardGrid grid)
    {
        int result = grid.CheckWinner();

        switch (result)
        {
        case 1:
            return(10);

        case 2:
            return(-10);

        case 0:
            return(0);

        default:
            return(-1);
        }
    }