Compsci 101, Fall 2012, Jotto Assignment: Playing the Game
See the
howto pages for details on creating projects,
files, and so on. The pages here describe how to play Jotto.
javascript version to see/play
Playing the Game
The explanation below illustrates how to play the game. The
logical-thinking illustrated in the example is not something you
will program. You'll program a much simpler form of computer
"intelligence" described after the explanation of how the game is
played. These screen shots are from a web-based game. The Jotto
game you write has screen shots that are shown after the Jotto
explanation below.
You can play Jotto online via several sites. The
site linked
here allows you, a human player, to guess the words, but the
computer helps by eliminating letters that cannot be part of a
word. For example, the series of screen shots below shows what's
displayed as I tried to guess the computer's secret word. The last
screen shot on the right is just before I "win" the game by guessing
the secret word (can you guess it as well?). In this online version,
duplicate letters in word are not allowed. Letters that have been
eliminated from being possible are shown in red, letters that must
be in the word are shown in green.
First Screen Shot
For example, in the first screenshot on the upper-left I guessed the word
stick which had zero letters in common with the
computer's secret word. This results in each letter in
stick being eliminated, so they are shown in red after I
guessed stick. In the second screen on the upper-right guessed two
more words: lamps and ramps. Since
ramps has three letters in common while lamps
has only two, the computer can determine that 'R' must be in the
word and that 'L' cannot be in the word.
Second Screen Shot
The computer has not reasoned completely as a human might at this
point. For example, the word irate has two letters in common,
one is 'R', so the other is either (but not both) of 'A' and
'E'. Similarly one of 'A' or 'Y' must be in the secret word based
on my guess stray, but not both. If 'A' is not in
the word, thann both 'E' and 'Y' must be. However, since
money has only one-letter in common with the secret word
both 'E' and 'Y' cannot be in the word. Thus 'A' must be and 'E'
and 'Y' cannot be. However, the computer hasn't reasoned this
completely --- that kind of logic is harder to program.
Third Screen Shot
The next screen shot (lower-left) shows what happens after I guessed woman
and
stone. After guessing stone the computer knows that
exactly one of 'O', 'N', and 'E' is in the secret word since the
letters 'S' and 'T' have been eliminated. Using the guessed word
money the computer can immediately determine that neither
'M' nor 'Y' is in the secret word since one of 'O','N','E' is in the
word. When 'M' is eliminated from ramps and lamps
we know that 'A' and 'P' are in the secret word as well as
'R'. Because irate has two letters in common, we
eliminate 'E'.
Fourth Screen Shot
After fight has no letters in common the computer was able to
determine that 'O' must be in the word since ghost had one
letter in common. This eliminates 'W' (from woman) and 'N'
(from money). Eliminating 'N' can also be done based on
woman.
After guessing
bound the computer helps by eliminating 'U', 'B', and 'D' since
we know 'O' is in the secret word. only 'J', 'Q', 'V', 'X', and
'Z' are left. Because I know that there are no duplicate letters I
was able to guess the secret word at this point. Can you?
Duke Jotto
Here's a capture of me playing the game with the command-line version --- the computer is trying to guess
my word which is bagel: The user's input is in
italics.
Playing a game with 5 letter words
Number of words is 5757
My guess is 'vocab', how many letters in common with your word: 2
Number of words left is 1243
My guess is 'cased', how many letters in common with your word: 2
Number of words left is 495
My guess is 'choke', how many letters in common with your word: 1
Number of words left is 198
My guess is 'braze', how many letters in common with your word: 3
Number of words left is 35
My guess is 'bagel', how many letters in common with your word: 6
I win!! it took me 5 guesses
Here's a screen capture of the GUI version just before the computer
guessed my word which is bagel. When you use
the GUI-version make sure you choose new game from the Jotto menu
to start the play.
Please read the Howto carefully for guidance
and advice on what you need to implement.