コード例 #1
0
        // Ask if the player want to regret last move
        public static void displayRegretMessage()
        {
            // Display the chess board in console
            DisplayBoard.displayChessPanel();

            // Clear the input line
            Console.SetCursorPosition(0, 25);
            clearConsoleLine();
            // Clear the input message line
            Console.SetCursorPosition(0, 24);
            clearConsoleLine();
            // Display the regret confirmation message
            // If the player has no chance for regret anymore, no need to show this message
            if (Board.regretAmount[Board.currentColour % 2] > 0)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                if (Board.regretAmount[Board.currentColour % 2] == 1)
                {
                    Console.Write("This is your last chance to regret, sure? (y/n) ");
                }
                else if (Board.regretAmount[Board.currentColour % 2] > 1)
                {
                    Console.Write(Board.regretAmount[Board.currentColour % 2].ToString() + " chances left - Do you need to regret? (y/n) ");
                }
                Console.ResetColor();
                if (Console.ReadLine() == "y")
                {
                    GameRules.regret();
                }
            }
        }
コード例 #2
0
        // Ask the player to choose a piece to move
        public static void displayAskChooseMessage()
        {
            // Display the chess board in console
            DisplayBoard.displayChessPanel();
            // Display the current colour
            displayCurrentColour();

            // Clear the input line
            Console.SetCursorPosition(0, 25);
            clearConsoleLine();
            // Clear the input message line
            Console.SetCursorPosition(0, 24);
            clearConsoleLine();
            // Display the input message
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Please choose a piece to move (in form \'[row][notDigit][column]\' e.g. \'2,1\' \'7;7\'): ");
            Console.ResetColor();
        }