public HashSet <OpponentMove> GetPossibleOpponentMovesForGameState(GameState state)
        {
            HashSet <OpponentMove> possibleOpponentMoves = new HashSet <OpponentMove>();
            TicTacToeGameStateImpl ticTacToeState        = (TicTacToeGameStateImpl)state;

            for (byte i = 0; i < 3; ++i)
            {
                for (byte j = 0; j < 3; ++j)
                {
                    if (ticTacToeState.GetSquare(i, j) == 0)
                    {
                        TicTacToeGameStateImpl newState = GameStateFactory <TicTacToeGameStateImpl> .GetNewGameState(ticTacToeState);

                        newState.SetSquare(i, j, (byte)(GetNextPlayerIndex((byte)GetCurrentPlayerIndex()) + 1));
                        possibleOpponentMoves.Add(new OpponentMove(newState, 1));
                        playerGameStates.Add(newState);
                    }
                }
            }
            return(possibleOpponentMoves);
        }
        public bool PerformMove(GameState move)
        {
            TicTacToeGameStateImpl ticTacToeMove = (TicTacToeGameStateImpl)move;

            for (byte i = 0; i < 3; ++i)
            {
                for (byte j = 0; j < 3; ++j)
                {
                    if (ticTacToeMove.GetSquare(i, j) != 0)
                    {
                        if (game.MakeMove(i, j))
                        {
                            if (gameView != null)
                            {
                                gameView.ShowMoveInView(Tuple.Create <byte, byte, int>(i, j, GetCurrentPlayerIndex()));
                            }
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }