Skip to content

Commit

Permalink
fixed space bug
Browse files Browse the repository at this point in the history
  • Loading branch information
RamonTorresUta committed Aug 5, 2024
1 parent 446ce68 commit 52ea9a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/java/uta/cse3310/Round.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/uta/cse3310/Word.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public static void winner(ArrayList<String> 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);
}
}

Expand Down

0 comments on commit 52ea9a8

Please sign in to comment.