From fd67e95fe53acdc96c409ae0b1279df5ed546176 Mon Sep 17 00:00:00 2001 From: Matt Cantin Date: Mon, 13 Oct 2025 16:21:18 -0600 Subject: [PATCH 01/16] Added ASCII art to game launcher --- .idea/workspace.xml | 51 +++++++++++++++++++++++++++++++++++++++++++++ GameLauncher.java | 6 +++++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..0ff23f0 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + 1760390460371 + + + + \ No newline at end of file diff --git a/GameLauncher.java b/GameLauncher.java index d8285c3..86560f3 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -96,7 +96,11 @@ private static List registerGames() { protected void run() { boolean running = true; while (running) { - System.out.println("\n=== Console Arcade Hub ==="); + System.out.println( +"/ \\__/|/ __// \\ /|/ \\ /\\\n" ++ "| |\\/||| \\ | |\\ ||| | ||\n" ++ "| | ||| /_ | | \\||| \\_/|\n" ++ "\\_/ \\|\\____\\\\_/ \\|\\____/"); for (int i = 0; i < this.games.size(); i++) { System.out.printf("%d. %s\n", i + 1, From eb6b4d5dbcd48f547d610e001a59be65006ce5ea Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 14 Oct 2025 07:50:01 -0600 Subject: [PATCH 02/16] Delete .idea directory Signed-off-by: Matt --- .idea/workspace.xml | 51 --------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 0ff23f0..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - 1760390460371 - - - - \ No newline at end of file From 734cbaa2a8dd6f278d13019636c67ad64b3578d1 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 14 Oct 2025 07:50:18 -0600 Subject: [PATCH 03/16] Update .gitignore Signed-off-by: Matt --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6529974..44f1ce5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ history.dat reports/ doc/ +.idea/ # Java Section *.class From dcef9e23c0f098987daf3ffe277cbed574c7a1fc Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 14 Oct 2025 12:57:38 -0600 Subject: [PATCH 04/16] Update .gitignore Signed-off-by: Matt --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6529974..44f1ce5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ history.dat reports/ doc/ +.idea/ # Java Section *.class From 8bb5490b3a3f11be272ceeb845a04a12bb5e02ec Mon Sep 17 00:00:00 2001 From: Matt Cantin Date: Wed, 15 Oct 2025 14:54:27 -0600 Subject: [PATCH 05/16] Made text more readable --- GameLauncher.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/GameLauncher.java b/GameLauncher.java index 86560f3..dd7e109 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -96,11 +96,14 @@ private static List registerGames() { protected void run() { boolean running = true; while (running) { + System.out.println("\n=== Console Game Hub ===\n"); System.out.println( -"/ \\__/|/ __// \\ /|/ \\ /\\\n" -+ "| |\\/||| \\ | |\\ ||| | ||\n" -+ "| | ||| /_ | | \\||| \\_/|\n" -+ "\\_/ \\|\\____\\\\_/ \\|\\____/"); + " __ __ ___ _ _ _ _ \n" + + " | \\/ | __| \\| | | | |\n" + + " | |\\/| | _|| .` | |_| |\n" + + " |_| |_|___|_|\\_|\\___/ \n" + + " " + ); for (int i = 0; i < this.games.size(); i++) { System.out.printf("%d. %s\n", i + 1, From a2581d32e3d33270dde7886efa4b613375be9770 Mon Sep 17 00:00:00 2001 From: Matt Cantin Date: Wed, 15 Oct 2025 15:14:49 -0600 Subject: [PATCH 06/16] Fixed to pass tests --- GameLauncher.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GameLauncher.java b/GameLauncher.java index dd7e109..3f1758d 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -98,11 +98,11 @@ protected void run() { while (running) { System.out.println("\n=== Console Game Hub ===\n"); System.out.println( - " __ __ ___ _ _ _ _ \n" + - " | \\/ | __| \\| | | | |\n" + - " | |\\/| | _|| .` | |_| |\n" + - " |_| |_|___|_|\\_|\\___/ \n" + - " " + " __ __ ___ _ _ _ _ \n" + ++ " | \\/ | __| \\| | | | |\n" ++ " | |\\/| | _|| .` | |_| |\n" ++ " |_| |_|___|_|\\_|\\___/ \n" ++ "\n" ); for (int i = 0; i < this.games.size(); i++) { System.out.printf("%d. %s\n", From 5fdb89a8e708ad7f1ec0ec1167e3074bccf9a4a3 Mon Sep 17 00:00:00 2001 From: Matt Cantin Date: Wed, 15 Oct 2025 15:15:52 -0600 Subject: [PATCH 07/16] Fixed error --- GameLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameLauncher.java b/GameLauncher.java index 3f1758d..07f5270 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -98,7 +98,7 @@ protected void run() { while (running) { System.out.println("\n=== Console Game Hub ===\n"); System.out.println( - " __ __ ___ _ _ _ _ \n" + + " __ __ ___ _ _ _ _ \n" + " | \\/ | __| \\| | | | |\n" + " | |\\/| | _|| .` | |_| |\n" + " |_| |_|___|_|\\_|\\___/ \n" From e09e3e56b4c0bad91b1e0674217e0db7981cda3d Mon Sep 17 00:00:00 2001 From: Matt Cantin Date: Wed, 15 Oct 2025 15:17:31 -0600 Subject: [PATCH 08/16] Fixed checkstyle errors --- GameLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameLauncher.java b/GameLauncher.java index 07f5270..8615ff1 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -98,7 +98,7 @@ protected void run() { while (running) { System.out.println("\n=== Console Game Hub ===\n"); System.out.println( - " __ __ ___ _ _ _ _ \n" +" __ __ ___ _ _ _ _ \n" + " | \\/ | __| \\| | | | |\n" + " | |\\/| | _|| .` | |_| |\n" + " |_| |_|___|_|\\_|\\___/ \n" From 119b4116a35ccef1c2cd870dc5c61b500e7894e9 Mon Sep 17 00:00:00 2001 From: Matt Cantin Date: Wed, 15 Oct 2025 15:18:38 -0600 Subject: [PATCH 09/16] Fixed checkstyle errors --- GameLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameLauncher.java b/GameLauncher.java index 8615ff1..f827f11 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -96,7 +96,7 @@ private static List registerGames() { protected void run() { boolean running = true; while (running) { - System.out.println("\n=== Console Game Hub ===\n"); + System.out.println("=== Console Game Hub ===\n"); System.out.println( " __ __ ___ _ _ _ _ \n" + " | \\/ | __| \\| | | | |\n" From c20df095d8c155afbf559ef600a8eddac3078241 Mon Sep 17 00:00:00 2001 From: Matt Cantin Date: Wed, 15 Oct 2025 15:26:13 -0600 Subject: [PATCH 10/16] Fixed checkstyle errors --- GameLauncher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameLauncher.java b/GameLauncher.java index f827f11..400a65c 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -96,9 +96,9 @@ private static List registerGames() { protected void run() { boolean running = true; while (running) { - System.out.println("=== Console Game Hub ===\n"); System.out.println( -" __ __ ___ _ _ _ _ \n" +"=== Console Game Hub === \n" ++ " __ __ ___ _ _ _ _ \n" + " | \\/ | __| \\| | | | |\n" + " | |\\/| | _|| .` | |_| |\n" + " |_| |_|___|_|\\_|\\___/ \n" From 9de4ce236dc3f2627c781918715d8ac9663dc248 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 15 Oct 2025 15:28:19 -0600 Subject: [PATCH 11/16] Remove .idea from .gitignore Removed .idea directory from gitignore. Signed-off-by: Matt --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 44f1ce5..6529974 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ history.dat reports/ doc/ -.idea/ # Java Section *.class From c84426e54dcf74c9cc7082d682c399168d3c7158 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 15 Oct 2025 15:29:25 -0600 Subject: [PATCH 12/16] Revert "Fixed checkstyle errors" --- GameLauncher.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/GameLauncher.java b/GameLauncher.java index 400a65c..d8285c3 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -96,14 +96,7 @@ private static List registerGames() { protected void run() { boolean running = true; while (running) { - System.out.println( -"=== Console Game Hub === \n" -+ " __ __ ___ _ _ _ _ \n" -+ " | \\/ | __| \\| | | | |\n" -+ " | |\\/| | _|| .` | |_| |\n" -+ " |_| |_|___|_|\\_|\\___/ \n" -+ "\n" - ); + System.out.println("\n=== Console Arcade Hub ==="); for (int i = 0; i < this.games.size(); i++) { System.out.printf("%d. %s\n", i + 1, From 01924fda49fc643c944b06d2e703e485cd931baf Mon Sep 17 00:00:00 2001 From: Erik Thompson Date: Mon, 20 Oct 2025 15:45:49 -0600 Subject: [PATCH 13/16] user story 26 Added line to display the number of remaining guesses in Jotto --- JottoGame.java | 1 + 1 file changed, 1 insertion(+) diff --git a/JottoGame.java b/JottoGame.java index f08af55..ad490b0 100644 --- a/JottoGame.java +++ b/JottoGame.java @@ -62,6 +62,7 @@ public Optional play() { int attemptsLeft = MAX_GUESSES; while (attemptsLeft > 0) { + System.out.println("You have " + attemptsLeft + " guesses remaining."); System.out.print("Enter guess: "); String guess = scanner.nextLine().trim().toUpperCase(); From 409a24369fc1b4b907789292951d25047e2f838d Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 22 Oct 2025 15:11:40 -0600 Subject: [PATCH 14/16] Revert Jotto in main branch Removed a line that prints the number of guesses remaining. Signed-off-by: Matt --- JottoGame.java | 1 - 1 file changed, 1 deletion(-) diff --git a/JottoGame.java b/JottoGame.java index ad490b0..f08af55 100644 --- a/JottoGame.java +++ b/JottoGame.java @@ -62,7 +62,6 @@ public Optional play() { int attemptsLeft = MAX_GUESSES; while (attemptsLeft > 0) { - System.out.println("You have " + attemptsLeft + " guesses remaining."); System.out.print("Enter guess: "); String guess = scanner.nextLine().trim().toUpperCase(); From ec8064d6863e588815617512c29dada82c81e70c Mon Sep 17 00:00:00 2001 From: ahmed Date: Mon, 27 Oct 2025 21:35:52 +0000 Subject: [PATCH 15/16] add borders to launcher nenu #36 --- GameLauncher.java | 11 +-- GameLauncher.java.save | 175 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 GameLauncher.java.save diff --git a/GameLauncher.java b/GameLauncher.java index 3f9ba0e..fd26f59 100644 --- a/GameLauncher.java +++ b/GameLauncher.java @@ -104,16 +104,17 @@ protected void run() { + " |_| |_|___|_|\\_|\\___/ \n" + "\n" ); + System.out.println("_____________________________"); for (int i = 0; i < this.games.size(); i++) { - System.out.printf("%d. %s\n", + System.out.printf("| %d. %s\n", i + 1, this.games.get(i).getName()); } - System.out.println("0. Exit"); - System.out.println("H. View Game History"); - System.out.println("C. Clear Game History"); + System.out.println("| 0. Exit"); + System.out.println("| H. View Game History"); + System.out.println("| C. Clear Game History"); + System.out.println("_____________________________"); System.out.print("Choose a game: "); - String input = this.scanner.nextLine().trim(); if (input.equalsIgnoreCase("H")) { this.historyTracker.displayHistory(); diff --git a/GameLauncher.java.save b/GameLauncher.java.save new file mode 100644 index 0000000..d125e64 --- /dev/null +++ b/GameLauncher.java.save @@ -0,0 +1,175 @@ +import java.util.Scanner; +import java.io.IOException; +import java.util.List; +import java.util.ArrayList; +import java.util.Optional; + +/** + * Console Game Hub. + * Provides an arcade-style launcher for multiple games, + * with support for scoring and history tracking. + * + * @author ChatGPT (from engineered prompts) + * @author Dr. Jody Paul + * @version 2.1 (Refactored. Includes dependency injection for testability.) + */ +public class GameLauncher { + /** Default history file name. */ + private static final String HISTORY_FILENAME = "history.dat"; + + /** Name of the history file. */ + private String historyFileName; + + /** Console input. */ + private final Scanner scanner; + + /** Collection of known games. */ + private final List games; + + /** Game history tracker. */ + private final GameHistoryTracker historyTracker; + + /** + * Default constructor, used in production. + * Loads default games, scanner, and history tracker. + */ + public GameLauncher() { + this(new Scanner(System.in), + GameHistoryTracker.loadHistory(HISTORY_FILENAME), + registerGames(), + HISTORY_FILENAME); + } + + /** + * Constructor with injected testable components. + * + * @param inputScanner the console input + * @param tracker the tracker to record and save history + * @param gameList the list of games available to play + * @param fileName the name of the history tracker file + */ + public GameLauncher(final Scanner inputScanner, + final GameHistoryTracker tracker, + final List gameList, + final String fileName) { + this.scanner = inputScanner; + this.historyTracker = tracker; + this.games = gameList; + this.historyFileName = fileName; + } + + /** + * Main entry point of the application. + * @param args command-line arguments (not used) + */ + public static void main(final String[] args) { + GameLauncher launcher = new GameLauncher(); + launcher.run(); + launcher.saveHistory(); + } + + /** + * Registers all available games in the arcade. + * @return list of all available games + */ + private static List registerGames() { + List games = new ArrayList<>(); + games.add(new TicTacToeGame()); + games.add(new WordGuessGame()); + games.add(new JottoGame()); + games.add(new HangmanGame()); + games.add(new SnakeGame()); + games.add(new ConnectFourGame()); + games.add(new MineSweeperGame()); + games.add(new SudokuGame()); + games.add(new NumberGuessGame()); + games.add(new MemoryMatchGame()); + games.add(new LightsOutGame()); + games.add(new MasterMindGame()); + return games; + } + + /** + * Runs the game launcher loop. + * Allows user to choose and play games, and to view history. + */ + protected void run() { + boolean running = true; + while (running) { + System.out.println( +"=== Console Game Hub === \n" ++ " __ __ ___ _ _ _ _ \n" ++ " | \\/ | __| \\| | | | |\n" ++ " | |\\/| | _|| .` | |_| |\n" ++ " |_| |_|___|_|\\_|\\___/ \n" ++ "\n" + ); + System.out.println("_____________________________"); + for (int i = 0; i < this.games.size(); i++) { + System.out.printf("|%d. %s\n", + i + 1, + this.games.get(i).getName()); + } + System.out.println("|0. Exit"); + System.out.println("|H. View Game History"); + System.out.println("|C. Clear Game History"); +System.out.println("_____________________________"); + System.out.println("|Choose a game: "); + String input = this.scanner.nextLine().trim(); + if (input.equalsIgnoreCase("H")) { + this.historyTracker.displayHistory(); + continue; + } else if (input.equalsIgnoreCase("C")) { + confirmClearHistory(); + continue; + } + + try { + int choice = Integer.parseInt(input); + if (choice == 0) { + running = false; + System.out.println("Goodbye!"); + } else if (choice > 0 && choice <= this.games.size()) { + Game game = this.games.get(choice - 1); + Optional score = game.play(); + this.historyTracker.recordPlay(game.getName(), + score.orElse(null)); + } else { + System.out.println("Invalid choice."); + } + } catch (NumberFormatException e) { + System.out.println( + "Please enter a valid number or Letters H or C."); + } + } + } + + + /** + * Clears the history after user confirmation. + * + */ + private void confirmClearHistory() { + System.out.println("Are you sure you want to clear history?"); + System.out.println("type CLEAR to confirm"); + System.out.println("or type anything else to cancel."); + + String input = this.scanner.nextLine().trim(); + if (input.equalsIgnoreCase("clear")) { + System.out.println("Clearing History.\n"); + historyTracker.clearHistory("history.dat"); + } + + } + + /** + * Saves the history of games played. + */ + protected void saveHistory() { + try { + this.historyTracker.saveHistory(this.historyFileName); + } catch (IOException e) { + System.out.println("game history save failed: " + e.getMessage()); + } + } +} From 3cf0e3be8cc89703fa6d30cc4448b5dcfed1c022 Mon Sep 17 00:00:00 2001 From: agina2004 <72883535+agina2004@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:47:39 -0600 Subject: [PATCH 16/16] Delete GameLauncher.java.save Signed-off-by: agina2004 <72883535+agina2004@users.noreply.github.com> --- GameLauncher.java.save | 175 ----------------------------------------- 1 file changed, 175 deletions(-) delete mode 100644 GameLauncher.java.save diff --git a/GameLauncher.java.save b/GameLauncher.java.save deleted file mode 100644 index d125e64..0000000 --- a/GameLauncher.java.save +++ /dev/null @@ -1,175 +0,0 @@ -import java.util.Scanner; -import java.io.IOException; -import java.util.List; -import java.util.ArrayList; -import java.util.Optional; - -/** - * Console Game Hub. - * Provides an arcade-style launcher for multiple games, - * with support for scoring and history tracking. - * - * @author ChatGPT (from engineered prompts) - * @author Dr. Jody Paul - * @version 2.1 (Refactored. Includes dependency injection for testability.) - */ -public class GameLauncher { - /** Default history file name. */ - private static final String HISTORY_FILENAME = "history.dat"; - - /** Name of the history file. */ - private String historyFileName; - - /** Console input. */ - private final Scanner scanner; - - /** Collection of known games. */ - private final List games; - - /** Game history tracker. */ - private final GameHistoryTracker historyTracker; - - /** - * Default constructor, used in production. - * Loads default games, scanner, and history tracker. - */ - public GameLauncher() { - this(new Scanner(System.in), - GameHistoryTracker.loadHistory(HISTORY_FILENAME), - registerGames(), - HISTORY_FILENAME); - } - - /** - * Constructor with injected testable components. - * - * @param inputScanner the console input - * @param tracker the tracker to record and save history - * @param gameList the list of games available to play - * @param fileName the name of the history tracker file - */ - public GameLauncher(final Scanner inputScanner, - final GameHistoryTracker tracker, - final List gameList, - final String fileName) { - this.scanner = inputScanner; - this.historyTracker = tracker; - this.games = gameList; - this.historyFileName = fileName; - } - - /** - * Main entry point of the application. - * @param args command-line arguments (not used) - */ - public static void main(final String[] args) { - GameLauncher launcher = new GameLauncher(); - launcher.run(); - launcher.saveHistory(); - } - - /** - * Registers all available games in the arcade. - * @return list of all available games - */ - private static List registerGames() { - List games = new ArrayList<>(); - games.add(new TicTacToeGame()); - games.add(new WordGuessGame()); - games.add(new JottoGame()); - games.add(new HangmanGame()); - games.add(new SnakeGame()); - games.add(new ConnectFourGame()); - games.add(new MineSweeperGame()); - games.add(new SudokuGame()); - games.add(new NumberGuessGame()); - games.add(new MemoryMatchGame()); - games.add(new LightsOutGame()); - games.add(new MasterMindGame()); - return games; - } - - /** - * Runs the game launcher loop. - * Allows user to choose and play games, and to view history. - */ - protected void run() { - boolean running = true; - while (running) { - System.out.println( -"=== Console Game Hub === \n" -+ " __ __ ___ _ _ _ _ \n" -+ " | \\/ | __| \\| | | | |\n" -+ " | |\\/| | _|| .` | |_| |\n" -+ " |_| |_|___|_|\\_|\\___/ \n" -+ "\n" - ); - System.out.println("_____________________________"); - for (int i = 0; i < this.games.size(); i++) { - System.out.printf("|%d. %s\n", - i + 1, - this.games.get(i).getName()); - } - System.out.println("|0. Exit"); - System.out.println("|H. View Game History"); - System.out.println("|C. Clear Game History"); -System.out.println("_____________________________"); - System.out.println("|Choose a game: "); - String input = this.scanner.nextLine().trim(); - if (input.equalsIgnoreCase("H")) { - this.historyTracker.displayHistory(); - continue; - } else if (input.equalsIgnoreCase("C")) { - confirmClearHistory(); - continue; - } - - try { - int choice = Integer.parseInt(input); - if (choice == 0) { - running = false; - System.out.println("Goodbye!"); - } else if (choice > 0 && choice <= this.games.size()) { - Game game = this.games.get(choice - 1); - Optional score = game.play(); - this.historyTracker.recordPlay(game.getName(), - score.orElse(null)); - } else { - System.out.println("Invalid choice."); - } - } catch (NumberFormatException e) { - System.out.println( - "Please enter a valid number or Letters H or C."); - } - } - } - - - /** - * Clears the history after user confirmation. - * - */ - private void confirmClearHistory() { - System.out.println("Are you sure you want to clear history?"); - System.out.println("type CLEAR to confirm"); - System.out.println("or type anything else to cancel."); - - String input = this.scanner.nextLine().trim(); - if (input.equalsIgnoreCase("clear")) { - System.out.println("Clearing History.\n"); - historyTracker.clearHistory("history.dat"); - } - - } - - /** - * Saves the history of games played. - */ - protected void saveHistory() { - try { - this.historyTracker.saveHistory(this.historyFileName); - } catch (IOException e) { - System.out.println("game history save failed: " + e.getMessage()); - } - } -}