// description: The main cconstructor for P1, automatically starts the game once // the class is created. // input: none // processing: The user is prompted for input that is then passed through to // the commandLine() function. As long as the commandLine() // returns true, the game will keep going until the user types quit. // output: none public Main() { gameState = newGame(); while (gameState) { if (!game.checkShiftState()) { game.resetShift(); } Console.Write(">"); string input = Console.ReadLine(); gameState = commandLine(input); } }
// description: Resets both the shift value and the statistics from // EncryptWord. Re-constructs the EncryptWord class. // input: none // processing: Re-Constructs EncryptWord. Calls the reset functions // in EncryptWord. Lets the user // know that the game has been reset. // output: none private bool newGame() { game = new EncryptWord(); game.resetShift(); game.resetStats(); return(true); }