Skip to content

Conversation

mknos
Copy link
Contributor

@mknos mknos commented Jan 25, 2024

  • When testing hangman with a small word list the game would terminate before it even started
  • get_a_word() assumed that the wordlist file had 9151 words in it
  • This would be a problem for larger word lists too; the list is effectively truncated
  • Scale random index ($val) based on the number of lines in word list (with penalty of reading list twice)
  • Filehandle FILE used in close() was incorrect
  • Raise error if close() failed
  • Test1: wordlist.txt with only 2 words
  • Test2: wordlist.txt from dict file on my linux system (101,924 words)

* When testing hangman with a small word list the game would terminate before it even started 
* get_a_word() assumed that the wordlist file had 9151 words in it
* This would be a problem for larger word lists too; the list is effectively truncated
* Scale random index ($val) based on the number of lines in word list (with penalty of reading list twice)
* Filehandle FILE used in close() was incorrect
* Raise error if close() failed
* Test1: wordlist.txt with only 2 words
* Test2: wordlist.txt from dict file on my linux system (101,924 words)
@github-actions github-actions bot added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: hangman The hangman program labels Jan 25, 2024
Copy link
Owner

@briandfoy briandfoy left a comment

Choose a reason for hiding this comment

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

That's such an oddly specific number.

@briandfoy briandfoy merged commit 469f392 into briandfoy:master Jan 25, 2024
@briandfoy briandfoy self-assigned this Jan 25, 2024
@briandfoy briandfoy added Status: accepted The fix is accepted Status: released there is a new release with this fix and removed Priority: low get to this whenever Status: accepted The fix is accepted labels Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: hangman The hangman program Status: released there is a new release with this fix Type: enhancement improve a feature that already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants