Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

When you play AoA, you're provided with information about which letters match. For example, let's assume the secret word is , and the player picks

image text in transcribedimage text in transcribed

When you play AoA, you're provided with information about which letters match. For example, let's assume the secret word is , and the player picks the letter . In that case, the returned "pattern" will be Looking at the list of words above, there are only two words that match: . If we count up the remaining letters, the new frequency map is: {a=2,b=1,d=1,e=2,l=1,t=1}. Since was guessed, the most common letter (tiebreaking by alphabet order) is a. Note that this is different from , which wouldn't have considered the provided pattern and would have chosen instead. Thus, this guesser will be a better player than the | In [getGuess(String pattern, List> guesses) method. Here, is a string like or or For this problem, we haven't provided any helper methods, but you're encouraged to write them. For example, in my solution, I wrote a method called which returns a frequency map like the one in the example above ({a=2,b=1,d=1,e=2,l=1,t=1}). But you could also make a function called something like | ] that takes as input a list of words and a pattern, and only returns words that match. The magic of helper functions is that you can make up whatever you want. If you write any helper methods (which you really should!), we encourage you to write code to verify that they work before using them. You can do this by adding function calls to your , e.g. [system. out.prntn(keepunyworas Inatmatcnrattern(pattern)]. You're also welcome to add automated tests for your helper methods to though we won't be officially teaching you how those work until Lab 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions