public static void ManageGame(CheckersGame game)
        {
            while (game.Status == CheckersGame.eGameStatus.ActiveGame)
            {
                game.CreateNewRound();
                while (game.Status == CheckersGame.eGameStatus.InRound)
                {
                    ManageRound(game);
                }

                if (game.Status == CheckersGame.eGameStatus.StartingNewRound)
                {
                    game.Status = CheckersGame.eGameStatus.ActiveGame;
                }
            }
        }
        private void endOfRoundScreen(CheckersGame i_Game, Square.eSquareType i_PlayerType, bool i_WinningPlayer, ref CheckersGame.eRoundOptions io_CurrentRound, ref string io_PreviousMove)
        {
            this.clearScreen();
            this.printEndGame(i_Game, i_PlayerType, i_WinningPlayer);

            if (!this.playerWantsAnotherRound(i_Game, i_PlayerType))
            {
                Console.WriteLine("Goodbye! :)");
                io_CurrentRound = CheckersGame.eRoundOptions.gameOver;
            }
            else
            {
                // player wants to play another game
                i_Game.CreateGameBoard(i_Game.Board.Size);
                io_PreviousMove = string.Empty;
            }
        }
        private void runGame(CheckersGame i_Game, int i_BoardSize)
        {
            string playerChoice  = string.Empty;
            Player currentPlayer = i_Game.PlayerOne;
            string previousMove  = string.Empty;
            string userMove      = string.Empty;

            CheckersGame.eRoundOptions gameStatus;
            CheckersGame.eRoundOptions currentRound = CheckersGame.eRoundOptions.passRound;

            while (currentRound != CheckersGame.eRoundOptions.gameOver)
            {
                this.clearScreen();
                this.printBoard(i_Game.Board);
                this.printTurn(previousMove, currentPlayer);

                if (currentPlayer.PlayerType != Square.eSquareType.playerPC)
                {
                    userMove = this.getUserMove(i_BoardSize);
                }
                else
                {
                    userMove = currentPlayer.ComputerMove(i_Game.Board);
                    Thread.Sleep(1200);
                }

                currentRound = i_Game.NewRound(userMove);

                gameStatus = i_Game.CheckGameStatus();

                if (gameStatus != CheckersGame.eRoundOptions.passRound)
                {
                    currentRound = gameStatus;
                }

                this.handleRound(ref previousMove, ref userMove, ref currentRound, currentPlayer, i_Game);
                currentPlayer = i_Game.GetCurrentPlayer();
            }
        }
        private bool playerWantsAnotherRound(CheckersGame i_Game, Square.eSquareType i_Player)
        {
            string playerChoice;
            bool   anotherRound = false;

            Console.WriteLine("{0}Would you like to play another round? <Y/N>", Environment.NewLine);
            playerChoice = Console.ReadLine().ToUpper();

            while (playerChoice != k_YesChar && playerChoice != k_NoChar)
            {
                Console.WriteLine("Invalid input, try again. . . ");
                playerChoice = Console.ReadLine();
            }

            Console.Write(Environment.NewLine);

            if (playerChoice != k_NoChar)
            {
                anotherRound = true;
            }

            return(anotherRound);
        }
        private void printEndGame(CheckersGame i_Game, Square.eSquareType i_PlayerType, bool i_WinningPlayer)
        {
            if (i_PlayerType != Square.eSquareType.none)
            {
                if (i_WinningPlayer)
                {
                    if (i_PlayerType == Square.eSquareType.playerOne)
                    {
                        Console.Write("{0}{1} won the game!", Environment.NewLine, i_Game.PlayerOne.Name);
                    }
                    else
                    {
                        Console.Write("{0}{1} won the game!", Environment.NewLine, i_Game.PlayerTwo.Name);
                    }
                }
                else
                {
                    if (i_PlayerType == Square.eSquareType.playerOne)
                    {
                        Console.Write("{0}{1} won the game!", Environment.NewLine, i_Game.PlayerTwo.Name);
                    }
                    else
                    {
                        Console.Write("{0}{1} won the game!", Environment.NewLine, i_Game.PlayerOne.Name);
                    }
                }
            }
            else
            {
                Console.WriteLine("Its a tie!");
            }

            Console.Write(Environment.NewLine);
            Console.WriteLine("{0}'s score is: {1}", i_Game.PlayerOne.Name, i_Game.PlayerOne.Score);
            Console.WriteLine("{0}'s score is: {1}", i_Game.PlayerTwo.Name, i_Game.PlayerTwo.Score);
        }
        private void handleRound(ref string io_PreviousMove, ref string io_UserMove, ref CheckersGame.eRoundOptions io_CurrentRound, Player i_CurrentPlayer, CheckersGame i_Game)
        {
            bool iswinnigPlayer = false;

            if (io_CurrentRound == CheckersGame.eRoundOptions.weakPlayerQuits)
            {
                this.endOfRoundScreen(i_Game, i_CurrentPlayer.PlayerType, iswinnigPlayer, ref io_CurrentRound, ref io_PreviousMove);
            }
            else if (io_CurrentRound == CheckersGame.eRoundOptions.strongPlayerWantsToQuit)
            {
                // another round - Quit
                Console.WriteLine("You are not the weak player! Enter a valid move. . .");
                Thread.Sleep(800);
            }
            else if (io_CurrentRound == CheckersGame.eRoundOptions.playerDidntEnterObligatoryMove)
            {
                // another round - Wrong move
                Console.WriteLine("Invalid move, you must eliminate your opponnent!");
                Thread.Sleep(800);
            }
            else if (io_CurrentRound == CheckersGame.eRoundOptions.currentPlayerHasAnotherRound)
            {
                // another round
                Console.WriteLine("{0} {1} has another turn", Environment.NewLine, i_CurrentPlayer.Name);
                Thread.Sleep(800);
            }
            else if (io_CurrentRound == CheckersGame.eRoundOptions.playerOneWon)
            {
                iswinnigPlayer = true;
                i_Game.endRoundScoreUpdate(Square.eSquareType.playerTwo);
                this.endOfRoundScreen(i_Game, Square.eSquareType.playerOne, iswinnigPlayer, ref io_CurrentRound, ref io_PreviousMove);
            }
            else if (io_CurrentRound == CheckersGame.eRoundOptions.playerTwoWon)
            {
                iswinnigPlayer = true;
                i_Game.endRoundScoreUpdate(Square.eSquareType.playerOne);
                this.endOfRoundScreen(i_Game, Square.eSquareType.playerTwo, iswinnigPlayer, ref io_CurrentRound, ref io_PreviousMove);
            }
            else if (io_CurrentRound == CheckersGame.eRoundOptions.gameIsATie)
            {
                this.endOfRoundScreen(i_Game, Square.eSquareType.none, iswinnigPlayer, ref io_CurrentRound, ref io_PreviousMove);
            }
            else if (io_CurrentRound == CheckersGame.eRoundOptions.playerEnteredInvalidMove)
            {
                Console.WriteLine("Invalid move, try again . . .");
                Thread.Sleep(800);
            }
            else
            {
                string shape = i_Game.Board.SquareToString(i_Game.Board.GetSquareStatus(Move.Parse(io_UserMove).SquareTo));
                io_PreviousMove = i_CurrentPlayer.Name + "'s move was (" + shape + "): " + io_UserMove;
            }
        }