This site applies only to CMPT 120 D1 (Burnaby) in Summer 2011. See the other instructors' pages for other sections.
Since sample runs of this program tend to be quite long, these examples have been moved to another page.
A Winning Game
This run shows what your program should look like when the guesser wins.
Enter the secret word: PYTHON
------------------------------------------------------------
Word so far: ______
Misses: 0
What letter would you like to guess? A
Word so far: ______
Misses: 1
What letter would you like to guess? E
Word so far: ______
Misses: 2
What letter would you like to guess? U
Word so far: ______
Misses: 3
What letter would you like to guess? O
Word so far: ____O_
Misses: 3
What letter would you like to guess? I
Word so far: ____O_
Misses: 4
What letter would you like to guess? T
Word so far: __T_O_
Misses: 4
What letter would you like to guess? H
Word so far: __THO_
Misses: 4
What letter would you like to guess? M
Word so far: __THO_
Misses: 5
What letter would you like to guess? N
Word so far: __THON
Misses: 5
What letter would you like to guess? Y
Word so far: _YTHON
Misses: 5
What letter would you like to guess? P
You guessed the secret correctly: PYTHON
A Losing Game
This run shows what your program should look like when the guesser loses.
Enter the secret word: ALGORITHM
------------------------------------------------------------
Word so far: _________
Misses: 0
What letter would you like to guess? E
Word so far: _________
Misses: 1
What letter would you like to guess? R
Word so far: ____R____
Misses: 1
What letter would you like to guess? A
Word so far: A___R____
Misses: 1
What letter would you like to guess? I
Word so far: A___RI___
Misses: 1
What letter would you like to guess? U
Word so far: A___RI___
Misses: 2
What letter would you like to guess? M
Word so far: A___RI__M
Misses: 2
What letter would you like to guess? Q
Word so far: A___RI__M
Misses: 3
What letter would you like to guess? U
Word so far: A___RI__M
Misses: 4
What letter would you like to guess? Y
Word so far: A___RI__M
Misses: 5
What letter would you like to guess? B
You lose. The secret was: ALGORITHM
Case and Bad Input
This run shows what should happen in two “bad input” cases. First, mixed upper- and lowercase (you don't have to deal with case at all). Second, if the user inputs zero or more than one character, they should get an error message.
Enter the secret word: BINARY
------------------------------------------------------------
Word so far: ______
Misses: 0
What letter would you like to guess? B
Word so far: B_____
Misses: 0
What letter would you like to guess? i
Word so far: B_____
Misses: 1
What letter would you like to guess? n
Word so far: B_____
Misses: 2
What letter would you like to guess? I
Word so far: BI____
Misses: 2
What letter would you like to guess? N
Word so far: BIN___
Misses: 2
What letter would you like to guess? ARY
You must guess a single letter.
Word so far: BIN___
Misses: 2
What letter would you like to guess?
You must guess a single letter.
Word so far: BIN___
Misses: 2
What letter would you like to guess? R
Word so far: BIN_R_
Misses: 2
What letter would you like to guess? RER**&#
You must guess a single letter.
Word so far: BIN_R_
Misses: 2
What letter would you like to guess? A
Word so far: BINAR_
Misses: 2
What letter would you like to guess? Y
You guessed the secret correctly: BINARY