Exemple #1
0
        public Move PlayMove(int fromRow, int fromCol, int toRow, int toCol)
        {
            Move move = _gameObject.Move(fromRow, fromCol, toRow, toCol);

            if (move.ValidMove)
            {
                int winner = _gameObject.CheckForWinState();
                if (winner != 0)
                {
                    _winner = winner;
                }
                if (!move.AvailableMoves.Any())
                {
                    lock (_lock)
                    {
                        if (_currentPlayer == 1)
                        {
                            _currentPlayer = 2;
                        }
                        else
                        {
                            _currentPlayer = 1;
                        }
                    }
                }
            }
            return(move);
        }