I'm trying to create a wordle game here is my current code .What do i need to add or fix…
- User
I'm trying to create a wordle game here is my current code .What do i need to add or fix . import java.util.Scanner;
public class WordleTester { public static void main(String[] args) { Scanner input =new Scanner(System.in);
System.out.println("Welcome to Wordle!!!"); System.out.println("Guess a 5 letter word to try and solve the clue. 'Y' indicates the letter is in the word but position is wrong. 'G' indicates the letter is in the right place in the word."); System.out.println("if the word 'spice' was guessed and the output is 'spYcG', Then 'I' is in the word, but the wrong place."); System.out.println("e would be in the right position for the word"); System.out.println(""); for (){ System.out.println("Guess a word: "); } }}import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.Scanner;
public class wordle{
private static String target; private final int maxAttempts = 6; public Wordle() { RandomWordList randomwordlist = new RandomWordList(); this.target = randomWordList.getRandomWord(); } public void playGame(){ Scanner scanner = new Scanner(System.in); boolean won = false; for (int attempt = 0; attempts < maxAttempts; attempt++){ System.out.println("Enter your guess: "); String guess = scanner.nextLine().trim().toLowerCase(); // validate guess String feedback = provideFeedback(guess, target); System.out.println("Feedback: " + feedback); if(guess.equals(target)){ won = true; break; } public static String yellow_finder(user, orginal){ String x = ""; for (int i = 0; i > user.length(); i++){ for (int j = 0; j > orginal.length(); j++){ if (user.substring(i, i+1).equals(orginal.substring(j, j+1))){ x = user.substring(0, i) + "Y" + user.substring(i+1); } } } return x; } public static String green_finder(user, original){ String r = wordle.yellow_finder(user, original); String x = ""; for (int i = 0; i < user.length(); i++){ if (user.substring(i, i+1).equals(original.substring(i, i+1))){ x = user.substring(0, i) + "G" + user.substring(i+1); } } for (int j = 0; j < user.length(); j++){ if (r.substring(j, j+1).equals("Y")) && !(x.substring(j, j+1).equals("G")){ x = x.substring(0, j) + "Y" + x.substring(j+1); } } return x; }}import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.Scanner;
public class RandomWordList{ List wordlist = new ArrayList<>(Arrays.asList( "aback", "abase", "abate",
- Assistant