Skip to content

Add reverse hangman game - #92

Merged
Yugo206 merged 3 commits into
Yugo206:mainfrom
Atharv-AC:reverse-hangman
Jun 24, 2026
Merged

Add reverse hangman game#92
Yugo206 merged 3 commits into
Yugo206:mainfrom
Atharv-AC:reverse-hangman

Conversation

@Atharv-AC

Copy link
Copy Markdown
Contributor

Description

Added a new logic game: Reverse Hangman.

In this game, the player thinks of a secret word and the computer attempts to guess it by proposing letters. The player responds only with:

  • y if the letter is in the word
  • n if the letter is not in the word

The game uses a simple dictionary-based approach and letter-frequency analysis to narrow down possible candidate words.

Checklist

  • My game defines an AUTHOR variable
  • My game defines a run() function
  • I did NOT add run() at the end of the file
  • I did NOT add if __name__ == "__main__"
  • I removed any .pyc files
  • I removed any .DS_Store files
  • The game works correctly when launched from launcher.py

Issue

Closes #84

@Yugo206 Yugo206 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

The game works and the idea is interesting. Before merging, I have one question about the gameplay:

Currently, when the program asks whether a letter is in the word, the player only answers “y” or “n”. This means the program never learns the positions of the letters, which is usually an important part of Reverse Hangman.

Was this a deliberate design choice, or would you consider extending it so the player can provide letter positions as well?

I’d like to hear your thoughts before merging.

@Atharv-AC

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback — that is a good point. The original y/n flow was a simplified first version, but I agree that learning letter positions is important for Reverse Hangman and makes candidate filtering much more accurate.

I’ll update the game so that when the player confirms a letter is present, they can enter all matching positions. The game will then retain only words where that letter occurs in exactly those positions. I’ll also update the instructions and add validation for the position input.

@Atharv-AC

Copy link
Copy Markdown
Contributor Author

Implemented the requested update in the latest commit. The game now asks for all 1-based positions when a guessed letter is present and filters candidates by the exact occurrences. I also added input validation and updated the instructions.

@Yugo206 Yugo206 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! The position-based system is a great improvement and makes the game much closer to a true Reverse Hangman.

The only remaining issue is that the CI is failing because the project does not allow if name == "main" blocks. The launcher automatically discovers and runs games through the run() function.

Could you remove:

if name == "main":
run()

and push a small follow-up commit? Once that’s fixed, this looks good to me.

@Atharv-AC

Copy link
Copy Markdown
Contributor Author

I have removed the:

if name == "main":
run()

Please review once again we are good to go.

@Yugo206

Yugo206 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Everything is ready.

@Yugo206
Yugo206 merged commit 9b6fd70 into Yugo206:main Jun 24, 2026
1 check passed
@Atharv-AC

Copy link
Copy Markdown
Contributor Author

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Reverse Hangman game

2 participants