The Wicked Hangman Game & Debug Mode Printing In Wicked Hangman - IT Assignment Help

Download Solution Order New Solution
Assignment Task -                 

 

Phase 2: The Wicked Hangman Game. 

While in the regular Hangman game, the program chooses one word at the beginning of the game and responds to your guesses based on that one word, in the Wicked Hangman Game, the computer program does not choose a single word. It starts with a list of words (for example all words with 8 letters from the dictionary). When the user guesses a letter, the program groups the existing words into different groups based on what positions it will reveal for each word with the guessed letter. For example, this is the output of playing the Wicked Hangman Game with the debug-printing on to reveal the internals of how the game is proceeding. 

$ python3 hangman.py words.txt 3 5 debug 

908 words left. 

___ 

missed letters: (5 chances left) 

Enter your guess: a 

_aa:1 

aa_:3 

a_a:8 

__a:27 

a__:56 

_a_:185 

___:628 

628 words left. 

___ 

missed letters: a (4 chances left) 

Enter your guess: n 

_nn:1 

n_n:1 

_n_:9 

n__:24 

__n:52 

___:541 

541 words left. 

___ 

missed letters: a n (3 chances left) 

Enter your guess: e 

ee_:1 

e_e:6 

_ee:14

e__:21 

__e:43 

_e_:95 

___:361 

361 words left. 

___ 

missed letters: a n e (2 chances left) 

Enter your guess: t 

t_t:3 

_t_:3 

t__:22 

__t:37 

___:296 

296 words left. 

___ 

missed letters: a n e t (1 chances left) 

Enter your guess: o 

o_o:1 

oo_:1 

_oo:7 

__o:9 

o__:17 

_o_:94 

___:167 

You lost after 5 wrong guesses. 

As you can see in the sample above, the blue highlighted output is debugging information that shows how the computer program is cheating by not keeping one word but many words as potential candidates. When the user give a guess, it groups all the candidates into different groups depending on the pattern it will reveal for the given word. And it always chooses the group with the most suitable words remaining. In the extreme example above, it happens to be the case that for any guess given (a n e t o), the largest group is the group that doesn't have.

 

$ python3 hangman.py words.txt 19 10 debug 

16 words left.

missed letters: (10 chances left) Enter your guess: a 

___________a____a__:1 ___________a_a_____:1 __________a__a_____:1 ________a______a___:1 ____a____________a_:1 __a_______a________:1 a__________a_______:1 _______________a___:1 _______a___________:1 _____a_____________:1 ____________a____a_:2 __________a________:2 ___________________:2 

2 words left. 

___________________ 

missed letters: a (9 chances left) Enter your guess: e 

______e_e__e__e__e_:1 _____e_e____e_e__e_:1 

1 words left. 

_____e_e____e_e__e_ 

missed letters: a (9 chances left) Enter your guess: n 

_____e_en___ene__e_:1 

1 words left. 

_____e_en___ene__e_ 

missed letters: a (9 chances left) Enter your guess: s 

_____e_ens__enesses:1 

1 words left. 

_____e_ens__enesses 

missed letters: a (9 chances left) Enter your guess: c

c____e_ens__enesses:1 

1 words left. 

c____e_ens__enesses 

missed letters: a (9 chances left) Enter your guess: i 

c____e_ensi_enesses:1 

1 words left. 

c____e_ensi_enesses 

missed letters: a (9 chances left) Enter your guess: o 

co___e_ensi_enesses:1 

1 words left. 

co___e_ensi_enesses 

missed letters: a (9 chances left) Enter your guess: m 

com__e_ensi_enesses:1 

1 words left. 

com__e_ensi_enesses 

missed letters: a (9 chances left) Enter your guess: p 

comp_e_ensi_enesses:1 

1 words left. 

comp_e_ensi_enesses 

missed letters: a (9 chances left) Enter your guess: r 

compre_ensi_enesses:1 

1 words left. 

compre_ensi_enesses 

missed letters: a (9 chances left) Enter your guess: h 

comprehensi_enesses:1 

1 words left. 

comprehensi_enesses

missed letters: a (9 chances left) 

Enter your guess: v 

comprehensivenesses:1 

You guessed the word: comprehensivenesses 

As you can see in the above example, the wicked hangman game could quickly be reduced to the regular hangman game if we didn't have too many words to start with. Only the first step the computer can cheat its way by choosing a group with two words that does not have letter 'a', and after that it soon had to be settled with only one word that has a consistent response to all the letters guessing. This is very different from the example with many three letter words earlier. The program can choose words that does not have 'a' or 'n' or 'e' or 't' or 'o' and still have many words to choose from. 

Your job is to write a wicked hangman engine that plays the game with a set of words to start with, and for each round of the user's guess, instead of giving response based on one pre-chosen word, you analysis groupings of possible reponses for all the remaining words, choose the grouping with the most words, and continue with the game. 

Implementation Details for Hangman 

Command line arguments and output for each round of the game: 

$ python3 hangman.py w1.txt 8 7 

missed letters: (7 chances left) 

Enter your guess: e 

After the hangman.py, the command line contains the following part: a file name with dictionary words; the length of the letters we will be guessing; the number of maximum misses allowed. 

 

This IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment Experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.