Inspiration

George Miller

What it does

You can play Wordle. If the letter is uppercase then it's in the correct spot. If the letter is lowercase it's in the word but wrong spot. If the letter doesn't show up it's not in the word at all.

How we built it

Using java

Challenges we ran into

Figuring out how to code double letters.

Accomplishments that we're proud of

Got it working I attached a picture of the code because I was unable to upload a .java file. I'm also putting it below:

import java.util.Scanner;

public class WordleGame { private static String[] words = {"apple", "berry", "chase", "delta", "eagle", "flame", "ghost", "haste", "igloo", "joker", "kneel", "lemon", "mango", "noble", "opera", "peach", "quilt", "raven", "steak", "tiger", "ultra", "viper", "whale", "xerox", "yield", "zebra"}; private static String hiddenWord = words[(int) (Math.random() * words.length)];

public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    for (int i = 1; i <= 6; i++) {
        System.out.println("Guess " + i + ": ");
        String guess = scanner.nextLine();
        printClue(guess, hiddenWord);
        if (guess.equals(hiddenWord)) {
            System.out.println("You won in " + i + " guesses!");
            return;
        }
    }
    System.out.println("You didn't guess the word. The hidden word was: " + hiddenWord);
}

public static void printClue(String guess, String hiddenWord) {
    String clue = "";
    for (int i = 0; i < guess.length(); i++) {
        char guessChar = guess.charAt(i);
        if (hiddenWord.charAt(i) == guessChar) {
            clue += Character.toUpperCase(guessChar) + " ";
        } else if (hiddenWord.contains(String.valueOf(guessChar))) {
            clue += Character.toLowerCase(guessChar) + " ";
        } else {
            clue += "_ ";
        }
    }
    System.out.println(clue.trim());
}

}

Built With

Share this project:

Updates