Exemplo n.º 1
0
        public void Play()
        {
            _board.ClearBoard();
            _board.PrintBoard();
            var currentPlayer = GamePiece.X;

            while (!_board.HasWinner() && !_board.IsCatGame())
            {
                _board.PlayRandom(currentPlayer);
                currentPlayer = GetNextPlayer(currentPlayer);
                _board.PrintBoard();
                Console.ReadKey();
            }

            if (!_board.HasWinner() && _board.IsCatGame())
            {
                Console.WriteLine($"Cat Game Found.");
                _board.PrintBoard();
                Console.ReadKey();
                return;
            }
            var winner = _board.GetWinner();

            Console.WriteLine($"Winning piece is {winner}");
            _board.PrintBoard();
            Console.ReadKey();
        }