[Community puzzle] Hangman

This topic is about the puzzle Hangman.

Feel free to send your feedback or ask some help here!

Hi, i can’t pass test 1, even if i try to hardcoded the result with any type of hangman ascii plus the input word since it’s stated as ā€œfound solutionā€.

Which language are you using?

i’m using javascript

Hi, I cannot pass the first test when submitting my code :confused:. All hardcoded tests pass, I have tried testing my code with different inputs but without result. Has someone any idea? (I’m using C#)
Edit: Well, I just solve my problem: I had a white space in my ASCII art :sweat_smile:

Thanks for the hint. I had the same problem (extra space in the gallows) with the first test. :frowning:

I found this easier than most Medium puzzles. Why is it hard, I wonder.

Hi, so I’ve passed all the test cases. But for some reason, when I submit my code, it says that I failed the first validation test. I’ve checked and there’s nothing wrong with the ASCII art. Any ideas?

Try testing that your code would successfully print all the versions of hangman - I.e. Empty, head, head and chest etc.

You can use the custom case below to help.

Custom Case

Hint: Try a case where there is only 1 incorrect guess.

Case Here

Input:

abiding
z a i b n g d

Expected output:

+--+
|  o
|
|\
abiding

Note: I’ve not actually done this puzzle myself yet but I believe this should be correct and help you out.

Hope this helps :slightly_smiling_face:

1 Like

Okay, you wouldn’t believe this… I’ve mistaken ā€˜!’ for ā€˜|’, that’s why I got it wrong! Maybe I should’ve get my eyes checked, lol. Anyway, thanks for your help!

1 Like
  • Description should mention about case in-sensitivity when handling the letters in given input (as in both uppercase and lowercase letters of the same alphabet are considered the same)

  • Should explicitly mention that one only needs to handle letters in the output, as in all non-alphabetic characters are not to be replaced with a _ in the output if not found.

  • Should highlight the word chars for Input && Constraint section

  • Constraints should mention the character range of entry too

Also missing

  • test case where the mistake count is greater than 6. This will cause a lot of solutions which do not exit early to fail

  • test case that includes special characters other than spaces in input, which will cause a lot of solutions that only check for c != " " to fail

All have been fixed.

Since the game is over after the 6th wrong guess is made, there shouldn’t be more guesses.

The input description states that only lowercase letters are guessed, so there shouldn’t be other special characters. The same with [[entry]], where I’ve added a constraint on that.

1 Like

Thanks for the fixes. I think you misunderstood me regarding this

Since the game is over after the 6th wrong guess is made, there shouldn’t be more guesses.

Yes, that is the rule, but some solutions like mine did not break out of the loop during the 6th mistake, which will cause Index Out Of Range Error for the 7th, 8th mistakes etc… which proves that test cases with more than 6 mistakes are non-existent, thus should be added. I can send you a screenshot of my solution via PM if you still cannot grasp on what I meant! :sweat_smile: