Exemplo n.º 1
0
        public Game(string i_Player1Name, string i_Player2Name, int i_BoardSize)
        {
            Player.eType player1Type            = Player.eType.Human;
            Player.eType player2Type            = i_Player2Name.Equals("Computer") ? Player.eType.Computer : Player.eType.Human;
            int          numberOfCoinsPerPlayer = calcNumberOfCoinsPerPlayer(i_BoardSize);

            r_Board   = new Board(i_BoardSize);
            r_Player1 = new Player(i_Player1Name, player1Type, Player.eCoinsSign.O, numberOfCoinsPerPlayer);
            r_Player2 = new Player(i_Player2Name, player2Type, Player.eCoinsSign.X, numberOfCoinsPerPlayer);
            setRandomMovePickerIfNecessary();
        }
Exemplo n.º 2
0
        /**
         * This method initializes the soldier's player type according to the soldier's type.
         */
        private void initPlayerType()
        {
            switch (m_SoldierType)
            {
            case eType.PlayerOne:
            case eType.PlayerOneKing:
                m_PlayerType = Player.eType.PlayerOne;

                break;

            case eType.PlayerTwo:
            case eType.PlayerTwoKing:
                m_PlayerType = Player.eType.PlayerTwo;

                break;
            }
        }
Exemplo n.º 3
0
        private void playTurn()
        {
            Player.eType playerTurnType = m_GameLogic.PlayerTurn.Type;

            do
            {
                if (playerTurnType == Player.eType.Human)
                {
                    humanPlayerPlay();
                    if (m_GameLogic.PlayerTurn.CanEatAgain)
                    {
                        displayBoard(false);
                    }
                }
                else
                {
                    computerPlayerPlay();
                }
            }while(m_GameLogic.PlayerTurn.CanEatAgain);
        }