From d62c8499a55e32253066f73fc696864bb06a1de7 Mon Sep 17 00:00:00 2001 From: JoshLapierre45 Date: Wed, 1 Oct 2025 14:48:42 -0600 Subject: [PATCH 01/31] Josh --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea47623..14cb661 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Console Game Hub - +# Josh Lapierre Repository for explorations of software development --- From d0ebecc5b7afab41486848b316ffcc9c15305378 Mon Sep 17 00:00:00 2001 From: bfcortesss Date: Wed, 1 Oct 2025 16:52:08 -0400 Subject: [PATCH 02/31] Making a change on README.md - BF --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ea47623..05c6280 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Brian F. + # Console Game Hub Repository for explorations of software development From 998b9512f4ccff70c8b367adbf636b43ef333494 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 1 Oct 2025 14:54:00 -0600 Subject: [PATCH 03/31] Update README.md name Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 14cb661..8caac76 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Console Game Hub # Josh Lapierre +# Hunter Hagerman Repository for explorations of software development --- From 879e1039e9d5b8fd7d28d00e6410635a1929d4cf Mon Sep 17 00:00:00 2001 From: CamCranda11 Date: Wed, 1 Oct 2025 16:58:10 -0400 Subject: [PATCH 04/31] added name --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8caac76..a168ed3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Console Game Hub # Josh Lapierre # Hunter Hagerman +# Cameron Crandall Repository for explorations of software development --- From 601a087986ebf4557e125b305cc5cb5c748c920e Mon Sep 17 00:00:00 2001 From: ahmedbacaad Date: Wed, 1 Oct 2025 17:39:13 -0400 Subject: [PATCH 05/31] added my name --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8bb34fa..c866339 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Brian F. # Josh Lapierre # Hunter Hagerman # Cameron Crandall +# Ahmed Abdi Repository for explorations of software development --- From 720cc0ea79bdd8b34bdc30efdfeba73111392ef0 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:56:31 -0600 Subject: [PATCH 06/31] Update GameHistoryTracker.java add if Score == null Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- GameHistoryTracker.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GameHistoryTracker.java b/GameHistoryTracker.java index ffd810e..e4e9faf 100644 --- a/GameHistoryTracker.java +++ b/GameHistoryTracker.java @@ -30,6 +30,9 @@ public void recordPlay(final String gameName, final Integer score) { if (score != null) { stats.totalScore += score; stats.scores.add(score); + } else if (score == null) { + System.out.println("Score is null"); + return; } statsMap.put(gameName, stats); } From aff990cf9a1780a3357037bdd3cb0994554391ab Mon Sep 17 00:00:00 2001 From: CamCranda11 <159499223+CamCranda11@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:45:02 -0600 Subject: [PATCH 07/31] Delete README.md Signed-off-by: CamCranda11 <159499223+CamCranda11@users.noreply.github.com> --- README.md | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index c866339..0000000 --- a/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Brian F. - -# Console Game Hub -# Josh Lapierre -# Hunter Hagerman -# Cameron Crandall -# Ahmed Abdi -Repository for explorations of software development - ---- ---- -### Overview -This project is a collaborative software development platform -designed for undergraduate CS students, featuring a -console-based arcade of classic and logic-driven games. - -It is intended to help students practice software -development principles (such as, agile development, -test-driven development, object-oriented design, pair-programming, -and refactoring) through fun and meaningful work. - -The goal is to reinforce core and agile software development -concepts and practices by contributing in an engaging, -real-world context. - -#### Test -`ant test` -#### Build -`ant jar` -#### Run -`java -jar build/jar/ConsoleGameHub.jar` - -### Activities - -The [Project](https://github.com/orgs/MetroCS/projects/9) contains a Kanban-style board of project activity - -See the [Issues](https://github.com/MetroCS/ConsoleGameHub/issues) tab for all associated user stories and tasks - ---- -## Information and Examples - -Visit the [website](https://metrocs.github.io/ConsoleGameHub/) for information and to download examples From 6d1a78a02d2b1496fea63967ff768be7a00a57f0 Mon Sep 17 00:00:00 2001 From: CamCranda11 <159499223+CamCranda11@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:51:44 -0600 Subject: [PATCH 08/31] Create README.md Signed-off-by: CamCranda11 <159499223+CamCranda11@users.noreply.github.com> --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ea47623 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Console Game Hub + +Repository for explorations of software development + +--- +--- +### Overview +This project is a collaborative software development platform +designed for undergraduate CS students, featuring a +console-based arcade of classic and logic-driven games. + +It is intended to help students practice software +development principles (such as, agile development, +test-driven development, object-oriented design, pair-programming, +and refactoring) through fun and meaningful work. + +The goal is to reinforce core and agile software development +concepts and practices by contributing in an engaging, +real-world context. + +#### Test +`ant test` +#### Build +`ant jar` +#### Run +`java -jar build/jar/ConsoleGameHub.jar` + +### Activities + +The [Project](https://github.com/orgs/MetroCS/projects/9) contains a Kanban-style board of project activity + +See the [Issues](https://github.com/MetroCS/ConsoleGameHub/issues) tab for all associated user stories and tasks + +--- +## Information and Examples + +Visit the [website](https://metrocs.github.io/ConsoleGameHub/) for information and to download examples From bdc24a59069c6400bdeed6025499812e61c197af Mon Sep 17 00:00:00 2001 From: hchagerman Date: Mon, 13 Oct 2025 17:41:51 -0400 Subject: [PATCH 09/31] jotto with a remainder --- JottoGame.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/JottoGame.java b/JottoGame.java index f08af55..b80b635 100644 --- a/JottoGame.java +++ b/JottoGame.java @@ -62,7 +62,8 @@ public Optional play() { int attemptsLeft = MAX_GUESSES; while (attemptsLeft > 0) { - System.out.print("Enter guess: "); + System.out.print("Remaining number of guesses: " + attemptsLeft + + System.lineSeparator() + "Enter guess: "); String guess = scanner.nextLine().trim().toUpperCase(); if (guess.length() != WORD_LENGTH || !guess.matches("[A-Z]+")) { From 0fdc58071b980ca286f0395d8b56f77ca5ab7fd4 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 20 Oct 2025 15:34:33 -0600 Subject: [PATCH 10/31] Update GameHistoryTracker.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- GameHistoryTracker.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/GameHistoryTracker.java b/GameHistoryTracker.java index e4e9faf..ffd810e 100644 --- a/GameHistoryTracker.java +++ b/GameHistoryTracker.java @@ -30,9 +30,6 @@ public void recordPlay(final String gameName, final Integer score) { if (score != null) { stats.totalScore += score; stats.scores.add(score); - } else if (score == null) { - System.out.println("Score is null"); - return; } statsMap.put(gameName, stats); } From d53d3ff1669e7aca2dc63019f6133a17b2f1bcc8 Mon Sep 17 00:00:00 2001 From: hchagerman Date: Wed, 22 Oct 2025 17:12:41 -0400 Subject: [PATCH 11/31] new --- WordGuessGame.java | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index e40967d..44f3ef1 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -1,4 +1,4 @@ -import java.util.Optional; +Ximport java.util.Optional; /** * A word guessing game similar to Wordle. @@ -11,7 +11,8 @@ * @version 1 */ class WordGuessGame implements Game { - + int wordLength = 5 + int NumberOfGuesses = 10; @Override public String getName() { return "Word Guess"; @@ -32,5 +33,27 @@ public Optional play() { + " after you guessed the word correctly!" ); return Optional.empty(); + string guess = EnterGuess(); + guess = GuessData(guess); } } + +} + public string EnterGuess(){ + system.out.println("enter your 5 letter guess"); + string guess = input.nextLine(); + return guess; +} + + public void GuessData(string guess){ + int GuessLength = guess.length(); + if (guess != 5){ + system.out.println("your guess needs to be 5 letters long"); + string guess = EnterGuess(); + GuessData(guess); + return guess; + } + else if(guesslength == 5){ + return guess; + } +} From df68c6a423a8519e558495cf6c07da995de602c5 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:16:18 -0600 Subject: [PATCH 12/31] Update WordGuessGame.java fixes Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 44f3ef1..0fc71ee 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -11,7 +11,6 @@ * @version 1 */ class WordGuessGame implements Game { - int wordLength = 5 int NumberOfGuesses = 10; @Override public String getName() { @@ -33,24 +32,22 @@ public Optional play() { + " after you guessed the word correctly!" ); return Optional.empty(); - string guess = EnterGuess(); - guess = GuessData(guess); + string guess = EnterGuess(); + guess = GuessData(guess); } -} - } public string EnterGuess(){ - system.out.println("enter your 5 letter guess"); - string guess = input.nextLine(); + system.out.println("enter your 5 letter guess"); + string guess = input.nextLine(); return guess; } public void GuessData(string guess){ - int GuessLength = guess.length(); - if (guess != 5){ - system.out.println("your guess needs to be 5 letters long"); - string guess = EnterGuess(); - GuessData(guess); + int GuessLength = guess.length(); + if (guess != 5){ + system.out.println("your guess needs to be 5 letters long"); + string guess = EnterGuess(); + GuessData(guess); return guess; } else if(guesslength == 5){ From 7b23d267b3b961e45873caaee5fda8a0e5bf56d4 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:24:32 -0600 Subject: [PATCH 13/31] Update WordGuessGame.java more fixes Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 0fc71ee..24ad310 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -1,4 +1,5 @@ -Ximport java.util.Optional; +import java.util.Optional; +import java.util.scanner; /** * A word guessing game similar to Wordle. @@ -12,6 +13,8 @@ */ class WordGuessGame implements Game { int NumberOfGuesses = 10; + Scanner input = new Scanner(System.in); + @Override public String getName() { return "Word Guess"; @@ -31,26 +34,25 @@ public Optional play() { "Your score is determined by the number of attempts remaining" + " after you guessed the word correctly!" ); - return Optional.empty(); string guess = EnterGuess(); guess = GuessData(guess); + return optional.empty(); } -} public string EnterGuess(){ system.out.println("enter your 5 letter guess"); string guess = input.nextLine(); return guess; } - public void GuessData(string guess){ + public string GuessData(string guess){ int GuessLength = guess.length(); if (guess != 5){ system.out.println("your guess needs to be 5 letters long"); string guess = EnterGuess(); - GuessData(guess); + guess = GuessData(guess); + return guess; + }else if(guesslength == 5){ return guess; } - else if(guesslength == 5){ - return guess; - } +} } From d71b4e855fe04022ebb7b8484a4da8f613c1762a Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:27:37 -0600 Subject: [PATCH 14/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 24ad310..4083b2e 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -1,5 +1,6 @@ import java.util.Optional; -import java.util.scanner; +import java.util.Scanner; + /** * A word guessing game similar to Wordle. From 5b478a166a99acfa1331ee1afecf6c655770b569 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:28:52 -0600 Subject: [PATCH 15/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 4083b2e..50eaf55 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -35,21 +35,21 @@ public Optional play() { "Your score is determined by the number of attempts remaining" + " after you guessed the word correctly!" ); - string guess = EnterGuess(); + String guess = EnterGuess(); guess = GuessData(guess); return optional.empty(); } - public string EnterGuess(){ + public String EnterGuess(){ system.out.println("enter your 5 letter guess"); - string guess = input.nextLine(); + String guess = input.nextLine(); return guess; } - public string GuessData(string guess){ + public String GuessData(String guess){ int GuessLength = guess.length(); if (guess != 5){ system.out.println("your guess needs to be 5 letters long"); - string guess = EnterGuess(); + String guess = EnterGuess(); guess = GuessData(guess); return guess; }else if(guesslength == 5){ From a15af0d519c9500e5f4c29bacc87ed83e344b669 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:31:20 -0600 Subject: [PATCH 16/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 50eaf55..01f2435 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -37,18 +37,18 @@ public Optional play() { ); String guess = EnterGuess(); guess = GuessData(guess); - return optional.empty(); + return Optional.empty(); } public String EnterGuess(){ - system.out.println("enter your 5 letter guess"); + System.out.println("enter your 5 letter guess"); String guess = input.nextLine(); return guess; } public String GuessData(String guess){ - int GuessLength = guess.length(); - if (guess != 5){ - system.out.println("your guess needs to be 5 letters long"); + int guessLength = guess.length(); + if (guessLength != 5){ + System.out.println("your guess needs to be 5 letters long"); String guess = EnterGuess(); guess = GuessData(guess); return guess; From 804a873aff60bb09f33c91df8642306615e3e0c0 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:32:26 -0600 Subject: [PATCH 17/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 01f2435..9d86de1 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -49,10 +49,10 @@ public String GuessData(String guess){ int guessLength = guess.length(); if (guessLength != 5){ System.out.println("your guess needs to be 5 letters long"); - String guess = EnterGuess(); + guess = EnterGuess(); guess = GuessData(guess); return guess; - }else if(guesslength == 5){ + }else if(guessLength == 5){ return guess; } } From 397bc1388a807b6eaba52fb574f9e79439862fbc Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:33:26 -0600 Subject: [PATCH 18/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 1 + 1 file changed, 1 insertion(+) diff --git a/WordGuessGame.java b/WordGuessGame.java index 9d86de1..11d4f52 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -56,4 +56,5 @@ public String GuessData(String guess){ return guess; } } + return Optional.empty(); } From ff9d621a4ab84d073b902495e90efa225205c982 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:35:07 -0600 Subject: [PATCH 19/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 11d4f52..3841013 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -55,6 +55,6 @@ public String GuessData(String guess){ }else if(guessLength == 5){ return guess; } + return guess; } - return Optional.empty(); } From 535af72c91aab27af8d50c2f34784d5ec737fd68 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:38:16 -0600 Subject: [PATCH 20/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 3841013..32496a9 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -47,7 +47,7 @@ public String EnterGuess(){ public String GuessData(String guess){ int guessLength = guess.length(); - if (guessLength != 5){ + if (guessLength != 5 || !guess.matches("[a-zA-Z]{5}")){ System.out.println("your guess needs to be 5 letters long"); guess = EnterGuess(); guess = GuessData(guess); From 828a1ee894cfd706e758a7851c0794ba01ee4ac2 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 14:38:59 -0600 Subject: [PATCH 21/31] Update JottoGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- JottoGame.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JottoGame.java b/JottoGame.java index b80b635..5dd8fbd 100644 --- a/JottoGame.java +++ b/JottoGame.java @@ -62,8 +62,8 @@ public Optional play() { int attemptsLeft = MAX_GUESSES; while (attemptsLeft > 0) { - System.out.print("Remaining number of guesses: " + attemptsLeft - + System.lineSeparator() + "Enter guess: "); + System.out.print("Enter guess: "); + String guess = scanner.nextLine().trim().toUpperCase(); if (guess.length() != WORD_LENGTH || !guess.matches("[A-Z]+")) { From 832236ab13729b61030e7883a5f49d7d029a1d14 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 14:40:18 -0600 Subject: [PATCH 22/31] Update JottoGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- JottoGame.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/JottoGame.java b/JottoGame.java index 5dd8fbd..f08af55 100644 --- a/JottoGame.java +++ b/JottoGame.java @@ -62,8 +62,7 @@ public Optional play() { int attemptsLeft = MAX_GUESSES; while (attemptsLeft > 0) { - System.out.print("Enter guess: "); - + System.out.print("Enter guess: "); String guess = scanner.nextLine().trim().toUpperCase(); if (guess.length() != WORD_LENGTH || !guess.matches("[A-Z]+")) { From 173188a5313533eb69138153f01a1c08e3afc80b Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:01:17 -0600 Subject: [PATCH 23/31] Update WordGuessGameTest.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGameTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/WordGuessGameTest.java b/WordGuessGameTest.java index aa85077..12f0d9c 100644 --- a/WordGuessGameTest.java +++ b/WordGuessGameTest.java @@ -27,6 +27,21 @@ public void testCorrectGuessOnFirstTry() { System.setIn(originalIn); } + @Test + public void testIncorrectThenCorrectGuess() { + String simulatedInput = "MANG0\app1e\n"; + InputStream originalIn = System.in; + System.setIn(new ByteArrayInputStream(simulatedInput.getBytes())); + + WordGuessGame game = new WordGuessGame(); + Optional result = game.play(); + + assertTrue(result.isPresent()); + assertEquals(5, result.get()); + + System.setIn(originalIn); + } + @Test public void testIncorrectThenCorrectGuess() { String simulatedInput = "MANGO\nAPPLE\n"; From 2eb983b4b1ee30e91e8539dc1010cd08384911cb Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:03:09 -0600 Subject: [PATCH 24/31] Update WordGuessGameTest.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGameTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordGuessGameTest.java b/WordGuessGameTest.java index 12f0d9c..af64428 100644 --- a/WordGuessGameTest.java +++ b/WordGuessGameTest.java @@ -29,7 +29,7 @@ public void testCorrectGuessOnFirstTry() { @Test public void testIncorrectThenCorrectGuess() { - String simulatedInput = "MANG0\app1e\n"; + String simulatedInput = "MANG0\n"; InputStream originalIn = System.in; System.setIn(new ByteArrayInputStream(simulatedInput.getBytes())); From f52bffdc95a5511bed8903781867566894398c54 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:03:59 -0600 Subject: [PATCH 25/31] Update WordGuessGameTest.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGameTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordGuessGameTest.java b/WordGuessGameTest.java index af64428..e2f11cc 100644 --- a/WordGuessGameTest.java +++ b/WordGuessGameTest.java @@ -28,7 +28,7 @@ public void testCorrectGuessOnFirstTry() { } @Test - public void testIncorrectThenCorrectGuess() { + public void testIfAllowNumberInput() { String simulatedInput = "MANG0\n"; InputStream originalIn = System.in; System.setIn(new ByteArrayInputStream(simulatedInput.getBytes())); From a7dec0d97a20124edc23a9f9b6be9722508c79aa Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:09:23 -0600 Subject: [PATCH 26/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 32496a9..dbbf0c7 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -13,8 +13,9 @@ * @version 1 */ class WordGuessGame implements Game { - int NumberOfGuesses = 10; + int NumberOfGuesses = 6; Scanner input = new Scanner(System.in); + String secretWord = "APPLE"; @Override public String getName() { @@ -35,6 +36,7 @@ public Optional play() { "Your score is determined by the number of attempts remaining" + " after you guessed the word correctly!" ); + String guess = EnterGuess(); guess = GuessData(guess); return Optional.empty(); From f1ae98c8e10c868e4f0ab7627cf6c2c281cf5f60 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:14:02 -0600 Subject: [PATCH 27/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index dbbf0c7..14ed6b0 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -39,12 +39,12 @@ public Optional play() { String guess = EnterGuess(); guess = GuessData(guess); - return Optional.empty(); + NumberOfGuesses--; + return Optional.of(NumberOfGuesses); } public String EnterGuess(){ System.out.println("enter your 5 letter guess"); - String guess = input.nextLine(); - return guess; + return input.nextLine(); } public String GuessData(String guess){ @@ -54,9 +54,8 @@ public String GuessData(String guess){ guess = EnterGuess(); guess = GuessData(guess); return guess; - }else if(guessLength == 5){ + }else { return guess; } - return guess; } } From 3e2b9e2afe92a4f3ddf97daa1ed640b7c56d0c3c Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:15:32 -0600 Subject: [PATCH 28/31] Update WordGuessGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- WordGuessGame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordGuessGame.java b/WordGuessGame.java index 14ed6b0..beedd02 100644 --- a/WordGuessGame.java +++ b/WordGuessGame.java @@ -49,7 +49,7 @@ public String EnterGuess(){ public String GuessData(String guess){ int guessLength = guess.length(); - if (guessLength != 5 || !guess.matches("[a-zA-Z]{5}")){ + if (guessLength != 5 || !guess.matches("[a-zA-Z0-9]{5}")){ System.out.println("your guess needs to be 5 letters long"); guess = EnterGuess(); guess = GuessData(guess); From c9b408381df69686229bc6d9a9acf6a585e013db Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:28:32 -0600 Subject: [PATCH 29/31] Update JottoGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- JottoGame.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/JottoGame.java b/JottoGame.java index f08af55..e88ab97 100644 --- a/JottoGame.java +++ b/JottoGame.java @@ -61,9 +61,10 @@ public Optional play() { + "letters: \"B\" and \"I\". "); int attemptsLeft = MAX_GUESSES; - while (attemptsLeft > 0) { - System.out.print("Enter guess: "); - String guess = scanner.nextLine().trim().toUpperCase(); + while (attemptsLeft > 0) { + System.out.print("Remaining number of guesses: " + attemptsLeft); + system.out.print("Enter guess: "); + String guess = scanner.nextLine().trim().toUpperCase(); if (guess.length() != WORD_LENGTH || !guess.matches("[A-Z]+")) { System.out.println("Invalid input. " From 77933fd9f4a25f460570f3860d92b061c9914ab9 Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:29:20 -0600 Subject: [PATCH 30/31] Update JottoGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- JottoGame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JottoGame.java b/JottoGame.java index e88ab97..9d95088 100644 --- a/JottoGame.java +++ b/JottoGame.java @@ -63,7 +63,7 @@ public Optional play() { while (attemptsLeft > 0) { System.out.print("Remaining number of guesses: " + attemptsLeft); - system.out.print("Enter guess: "); + System.out.print("Enter guess: "); String guess = scanner.nextLine().trim().toUpperCase(); if (guess.length() != WORD_LENGTH || !guess.matches("[A-Z]+")) { From 7b3abd588e4b54037e1e283131f72269ea137a8d Mon Sep 17 00:00:00 2001 From: hchagerman <123512775+hchagerman@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:30:59 -0600 Subject: [PATCH 31/31] Update JottoGame.java Signed-off-by: hchagerman <123512775+hchagerman@users.noreply.github.com> --- JottoGame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JottoGame.java b/JottoGame.java index 9d95088..e62b507 100644 --- a/JottoGame.java +++ b/JottoGame.java @@ -62,7 +62,7 @@ public Optional play() { int attemptsLeft = MAX_GUESSES; while (attemptsLeft > 0) { - System.out.print("Remaining number of guesses: " + attemptsLeft); + System.out.println("Remaining number of guesses: " + attemptsLeft); System.out.print("Enter guess: "); String guess = scanner.nextLine().trim().toUpperCase();