0

The task is to create an extremely difficult to beat guessing game for a word. I have included some example code but not sure of how to go about doing it.

class myWords
{
// These two lists already store words and letters guessed as needed.
List<string> myWords = new List<string>(); 
List<char> allGuessedLetters = new List<char>();

}

So above are just two simple Lists that store our words for the user to guess (These will all be if the same length)

Say the word list contains: Belly, Telly, Happy, Toast, Eggsy, Teams

They would be split up like this and the biggest group of words would be updated to the currentWords list and the correct "guessed letters" would display to the user.

User guesses letter 'E' creates the following groups.

- E - - - , -> Group 1: Belly, Telly, Teams
E - - - - , -> Group 2: Eggsy
- - - - - , -> Group 3: Happy, Toast

So since Group 1 was the biggest. currentWords would now consist of: Belly, Telly, Teams. The following would be displayed to the user - E - - -

My Idea was to perform some form of Loop:

public void OurGroups()
    {
        List<string> wordGrouping = new List<string>();
        foreach(string curWord in myWords)
        {
            // Split groups here
        }
    }
Jake Levy
  • 9
  • 1
  • And what happens in the second round? – xanatos Jan 05 '21 at 21:44
  • 1
    I'll add that it is a little complex if you begin considering words like Everest, that have 3 matches... Not impossible, but the "how much tall must I be to make this game" gets a little higher. – xanatos Jan 05 '21 at 21:46
  • how do you determine the size of the groups.. or which words go in which groups? – Jawad Jan 05 '21 at 21:51
  • 2
    I see a specification here (though, a vague one), but no actual _question_. What specifically do you need help with? Please provide a [mcve], explain what that code does, how it's different from what you want, and what _specifically_ it is you can't solve. What are you _asking_? – Peter Duniho Jan 05 '21 at 21:56
  • 1
    why would you want to display Group 3 - where there is no 'E' – coder_b Jan 05 '21 at 22:17
  • @Jawad this is determined by the user and the words are extracted from a txt file based on length – Jake Levy Jan 05 '21 at 22:28
  • 1
    @xanatos sorry my mistake: https://stackoverflow.com/questions/24501237/given-a-arraylist-of-words-and-user-input-how-to-map-them-into-families-in – Jake Levy Jan 05 '21 at 22:58

0 Answers0