Exemplo n.º 1
0
        public static eGameEndChoice getChoiseToContinuteTheGameFromClient()
        {
            bool           isInputValid = false;
            String         input;
            eGameEndChoice choiseToReturn = eGameEndChoice.Continue;

            Console.WriteLine("Write 'continue' to continue the game or 'end' to quit the game");
            while (!isInputValid)
            {
                input = Console.ReadLine();
                if (input.Equals("continue"))
                {
                    isInputValid   = true;
                    choiseToReturn = eGameEndChoice.Continue;
                }
                else if (input.Equals("end"))
                {
                    isInputValid   = true;
                    choiseToReturn = eGameEndChoice.Exit;
                }

                if (!isInputValid)
                {
                    Console.WriteLine("Write 'continue' to continue the game or 'end' to quit the game");
                }
            }

            return(choiseToReturn);
        }
        public CheckerBoard(CheckerBoard i_CloneToThisBoard)
        {
            Player otherFirstPlayer  = i_CloneToThisBoard.m_CurrentPlayer;
            Player otherSecondPlayer = i_CloneToThisBoard.m_OtherPlayer;

            m_CurrentPlayer = new Player(i_CloneToThisBoard.CurrentPlayer.PlayerName, otherFirstPlayer.TypeOfPlayer, otherFirstPlayer.NumberOfPlayer, i_CloneToThisBoard.m_SizeOfBoard);
            m_OtherPlayer   = new Player(otherSecondPlayer.PlayerName, otherSecondPlayer.TypeOfPlayer, otherSecondPlayer.NumberOfPlayer, i_CloneToThisBoard.m_SizeOfBoard);
            m_SizeOfBoard   = i_CloneToThisBoard.m_SizeOfBoard;
            m_GameEndChoice = i_CloneToThisBoard.m_GameEndChoice;
            m_GameStatus    = i_CloneToThisBoard.m_GameStatus;
            m_MovmentOption = i_CloneToThisBoard.m_MovmentOption;
            if (i_CloneToThisBoard.m_SoliderThatNeedToEatNextTurn != null)
            {
                m_SoliderThatNeedToEatNextTurn = new Soldier(i_CloneToThisBoard.m_SoliderThatNeedToEatNextTurn.CharRepresent, i_CloneToThisBoard.m_SoliderThatNeedToEatNextTurn.PlaceOnBoard, i_CloneToThisBoard.m_SoliderThatNeedToEatNextTurn.TypeOfSoldier);
            }

            m_CurrentPlayer.Soldiers = addSoldiers(m_CurrentPlayer.Soldiers);
            m_OtherPlayer.Soldiers   = addSoldiers(m_OtherPlayer.Soldiers);
        }
        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();
                }
            }
        }