コード例 #1
0
        private void initializeCheckerGame()
        {
            Player firstPlayer  = getPlayer(eNumberOfPlayer.First);
            Player secondPlayer = getPlayer(eNumberOfPlayer.Second);

            firstPlayer.generateSoliders(eNumberOfPlayer.First, m_SizeOfBoard);
            secondPlayer.generateSoliders(eNumberOfPlayer.Second, m_SizeOfBoard);
            m_CurrentPlayer = firstPlayer;
            m_OtherPlayer   = secondPlayer;
            m_GameStatus    = eGameStatus.ContinueGame;
            m_SoliderThatNeedToEatNextTurn = null;
            UIUtilities.initializeParameters();
        }
コード例 #2
0
        private void initializeStartCheckerBoard()
        {
            String     firstPlayerName, secondPlayerName;
            eSizeBoard sizeOfBoard;

            UIUtilities.getClientNamesAndTypeOfSecondPlayer(out firstPlayerName, out secondPlayerName, out sizeOfBoard);
            m_CurrentPlayer = new Player(firstPlayerName, eTypeOfPlayer.Human, eNumberOfPlayer.First, sizeOfBoard);
            m_SizeOfBoard   = sizeOfBoard;
            if (secondPlayerName == null)
            {
                m_OtherPlayer = new Player(Player.k_computerName, eTypeOfPlayer.Computer, eNumberOfPlayer.Second, sizeOfBoard);
            }
            else
            {
                m_OtherPlayer = new Player(secondPlayerName, eTypeOfPlayer.Human, eNumberOfPlayer.Second, sizeOfBoard);
            }

            m_MovmentOption = new MovementOptions(m_SizeOfBoard);
        }
コード例 #3
0
        public void startGame()
        {
            initializeStartCheckerBoard();
            while (m_GameEndChoice == eGameEndChoice.Continue)
            {
                while (m_GameStatus == eGameStatus.ContinueGame)
                {
                    Ex02.ConsoleUtils.Screen.Clear();
                    UIUtilities.PrintBoard(m_CurrentPlayer, m_OtherPlayer, (int)m_SizeOfBoard);
                    nextTurn();
                    setParamatersForNextTurn();
                }

                caclculateResultGame();
                UIUtilities.printResultOnScreen(m_CurrentPlayer, m_OtherPlayer, (int)m_SizeOfBoard);
                m_GameEndChoice = UIUtilities.getChoiseToContinuteTheGameFromClient();
                if (m_GameEndChoice == eGameEndChoice.Continue)
                {
                    initializeCheckerGame();
                }
            }
        }