Exemplo n.º 1
0
 public GamePlayer(eType i_Type, GameBoardCell.eType i_CellType, string i_PlayerName)
 {
     m_Score      = 0;
     r_Type       = i_Type;
     r_CellType   = i_CellType;
     r_PlayerName = i_PlayerName;
 }
Exemplo n.º 2
0
 public ReverseTicTacToeAlgo(GameBoardCell.eType i_CellType, GameState i_GameState, GameLogic i_GameLogic)
 {
     GameBoardCell.eType opponentCellType = (i_CellType == GameBoardCell.eType.X) ?
                                            GameBoardCell.eType.O : GameBoardCell.eType.X;
     r_GameLogic     = i_GameLogic;
     r_GameState     = i_GameState;
     r_OpponentIndex = i_GameLogic.CellTypeToPlayerIndex(opponentCellType);
     r_OwnIndex      = i_GameLogic.CellTypeToPlayerIndex(i_CellType);
 }
Exemplo n.º 3
0
        public Point?MakeMove(Board <GameBoardCell> i_Board, GameBoardCell.eType i_CellType, GameLogic i_GameLogic)
        {
            if (m_IsFirstMakeMove)
            {
                m_IsFirstMakeMove = false;
                init(i_CellType, i_GameLogic);
            }

            return(m_Algorithm.GetMove());
        }
Exemplo n.º 4
0
        // Makes a move. If bad input was recv, will return null.
        public Point?MakeMove(Board <GameBoardCell> i_Board, Point i_Input, GameBoardCell.eType i_CellType, GameLogic i_GameLogic)
        {
            Point?retMove = null;

            // checking if move is valid both here and in "GameManager". If the move is not valid in this stage, its the user's input fault.
            // If the move is not valid in "GameManager" Then its an error!
            if (i_GameLogic.IsMoveValid(i_Input))
            {
                retMove = i_Input;
            }

            return(retMove);
        }
Exemplo n.º 5
0
        // Converts GameBoardCell to Player's index in the Player's array.
        public uint CellTypeToPlayerIndex(GameBoardCell.eType i_Type)
        {
            uint?retIndex = null;

            if (i_Type != GameBoardCell.eType.None)
            {
                for (uint i = 0; i < r_Players.Length; i++)
                {
                    if (i_Type == r_Players[i].CellType)
                    {
                        retIndex = i;
                    }
                }
            }

            return((uint)retIndex);
        }
Exemplo n.º 6
0
 // Converts GameBoardCell to Player's index in the Player's array.
 public uint CellTypeToPlayerIndex(GameBoardCell.eType i_Type)
 {
     return(r_Players.CellTypeToPlayerIndex(i_Type));
 }
Exemplo n.º 7
0
 public void init(GameBoardCell.eType i_Sign, GameLogic i_GameLogic)
 {
     m_Algorithm = new ReverseTicTacToeAlgo(i_Sign, i_GameLogic.State, i_GameLogic);
 }