示例#1
0
        public static void DisplayBoard(GameBoardData i_GameData)
        {
            StringBuilder gameBoardString = new StringBuilder();

            Screen.Clear();
            gameBoardString.AppendFormat("{1}{0}", Environment.NewLine, k_MainHeader);
            gameBoardString.AppendFormat("{1}{0}{2}{0}", Environment.NewLine, k_TableHeader, k_Separator);
            gameBoardString.AppendFormat("| {1} |{2}|{0}{3}{0}", Environment.NewLine, k_HiddenGuess, k_EmptyResult, k_Separator);

            for (int i = 0; i < i_GameData.TotalNumberOfTurns; i++)
            {
                if (i >= i_GameData.TurnsPlayed)
                {
                    gameBoardString.AppendFormat("| {1} |{2}|{0}{3}{0}", Environment.NewLine, k_EmptyGuess, k_EmptyResult, k_Separator);
                }
                else
                {
                    gameBoardString.AppendFormat(
                        "| {1} |{2}|{0}{3}{0}",
                        Environment.NewLine,
                        IOConvertors.PinArrayToStringConvertor(i_GameData.GetTurn(i).Guess),
                        IOConvertors.resultStringBuilder(i_GameData.GetTurn(i).Results),
                        k_Separator);
                }
            }

            System.Console.WriteLine(gameBoardString);
        }