Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We can't use a char[] pattern because of limitations in the char type for tiles. Your tiles must be stored as strings! If you want


      

We can't use a char[] pattern because of limitations in the char type for tiles. Your tiles must be stored as strings!

If you want to run the code in jGRASP for debugging purposes, the tiles may or may not display correctly. In this case, you may want to temporarily change the strings to other characters so that it's easier to read.

record(String guess)

For each call to record, construct a Map to associate patterns with target word sets and use it to find all pick the pattern associated with the largest number of target words. When there are multiple patterns that have the same largest number of target words, pick the pattern that appears first in the sorted order, i.e. the pattern that appears earliest when iterating over the TreeMap. The associated target words becomes the dictionary for the next call to record.

It's necessary to construct a new Map on each call to record because the patterns depend on the given guess!

Development strategy

Implement the constructor and the words method first. Then, implement and test the patternFor static method. If your patternFor method is not working, your record method also will not work!

AbsurdleMain has two constants that you will want to change:

  • DICTIONARY_FILE represents the name of the file containing the list of initial words. By default, it reads from dictionary1.txt, which contains the official list of 2309 5-letter words used in Wordle. When testing, it may be easier to use the dictionary2.txt file that only contains 9 4-letter words.

  • SHOW_COUNT is false by default; set it to true to see the number of words under consideration.

---------------------------------------------

import java.util.*;

public class AbsurdleManager {
// TODO: Your Code Here

// The comment for this method is provided. Do not modify this comment:
// Params:
// String word -- the secret word trying to be guessed. Assumes word is made up of only
// lower case letters and is the same length as guess.
// String guess -- the guess for the word. Assumes guess is made up of only
// lower case letters and is the same length as word.
// Exceptions:
// none
// Returns:
// returns a string, made up of gray, yellow, or green squares, representing a
// standard wordle clue for the provided guess made against the provided secret word.
public static String patternFor(String word, String guess) {

}
}

Wordle is a word game where the player attempts to guess a 5-letter English word. Each incorrect guess receives feedback in the form of colored tiles indicating how closely the letter matches the target word. This image shows a game with 4 guesses (arise, route, rules, rebus) for the target word, rebus. Guessed letters that exactly match the target word are marked green while letters that are in the target word (but not in the right position) are marked yellow. Letters that aren't in the target word are marked gray. This result is typically expressed using a pattern of square emojis: each square corresponds to a letter.

Step by Step Solution

3.51 Rating (148 Votes )

There are 3 Steps involved in it

Step: 1

Answer Explanation I will help you in the creation of the wordle game using java swing A program that helps you solve the Wordle game You can download the completed project from the GitHub link below ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probability And Statistics For Engineers And Scientists

Authors: Anthony Hayter

3rd Edition

495107573, 978-0495107576

More Books

Students also viewed these Accounting questions