Пример #1
0
        private Player CheckCurrentStatus(Game ticTacToe)
        {
            Player winner = Player.None;

            for (int i = 0; i < ticTacToe.Dimensions; i++)
            {
                winner = TicTacToeHelper.CheckRow(ticTacToe, i);
                if (winner == Player.None)
                {
                    winner = TicTacToeHelper.CheckColumn(ticTacToe, i);
                    if (winner != Player.None)
                    {
                        return(winner);
                    }
                }
                else
                {
                    break;
                }
            }

            if (winner == Player.None)
            {
                winner = TicTacToeHelper.CheckDiagonal(ticTacToe);
            }

            return(winner);
        }
Пример #2
0
        public void CheckColumnTest()
        {
            CreateInstance(Constants.FILE_INPUT_PATH_CHECKCOLUMN);

            var expectedWinner = Player.O;
            var actualWinner   = TicTacToeHelper.CheckColumn(_game, 0);

            Assert.AreEqual(expectedWinner, actualWinner);
        }