From 52ea9a805645dca72c375b072d151a04a3cfc663 Mon Sep 17 00:00:00 2001 From: Ramon Torres Date: Sun, 4 Aug 2024 19:48:25 -0500 Subject: [PATCH] fixed space bug --- src/main/java/uta/cse3310/Round.java | 6 +++++- src/main/java/uta/cse3310/Word.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/uta/cse3310/Round.java b/src/main/java/uta/cse3310/Round.java index 12faa4d..efe07fd 100644 --- a/src/main/java/uta/cse3310/Round.java +++ b/src/main/java/uta/cse3310/Round.java @@ -136,7 +136,11 @@ private void solvePuzzle(Player currentPlayer) { System.out.println("Enter the solution:"); Scanner scanner = new Scanner(System.in); String solution = scanner.nextLine(); - if (word.solve(solution)) { + //String solutions = String.join("", solution); + //System.out.println("\nwhat you typed: " + solution); + String solutions = solution.replace(" ", ""); + if (word.solve(solutions) == true) { + //if(correctguesses.equals(lettersinword)){ System.out.println(currentPlayer.getName() + " solved the puzzle!"); currentPlayer.addScore(10); isRoundActive = false; diff --git a/src/main/java/uta/cse3310/Word.java b/src/main/java/uta/cse3310/Word.java index 6283aae..e2984c0 100644 --- a/src/main/java/uta/cse3310/Word.java +++ b/src/main/java/uta/cse3310/Word.java @@ -58,7 +58,10 @@ public static void winner(ArrayList wordsforgame) { public boolean solve(String solution) { String combinedWords = String.join("", wordsforgame); - return combinedWords.equals(solution); + System.out.println("\ncombined words for game: " + wordsforgame); + String combinedsolution = String.join(" ", solution); + System.out.println("what you typed combined: "+ combinedsolution); + return combinedWords.equals(combinedsolution); } }