minprog / hangman

1 stars 5 forks source link

Hangman missing test #2

Open bterwijn opened 4 years ago

bterwijn commented 4 years ago

Hello,

I noticed in Hangman that if a student produces a pattern with only zero or one (the last guessed) letter, that all check50 tests pass. But this is not what we want, we want to students to produce the pattern with possibly all letters guessed thus far to be able to show that pattern to the user. Otherwise the user never sees a pattern with more than one letter in it.

So instead of this:

  pattern = ""
  for letter in word:
    if letter == CURRENT_LETTER:
      pattern += letter
    else:
      pattern += "_"

we probably want students to do something like this:

  pattern = ""
  for letter in word:
    if letter in ALL_GUESSED_LETTERS:
      pattern += letter
    else:
      pattern += "_"

But there seems to be no check to enforce this.

Regards, Bas