I don't want to reinvent a whole hangman program, but here's a little idea which you guys might want to incorporate into the games you're creating -- a means to rate difficulty settings.
Take this little program as a quick demo:
CONST MinLength
= 4, MaxLength
= 10
File$ = "kjv10.txt" 'the King James Version 10 of the bible, from Project Gutenberg
PRINT "Processing book..."
LoadLists File$
PRINT "There are a total of"; WordCount
(0);
" words in our book."
FilterLists
PRINT "After we filter to exclude words too short, or too long, we have"; WordCount
(0);
" words left."
SortByWord
SortByFrequency
FOR i
= 1 TO WordCount
(0) PRINT Words
(i
); WordCount
(i
),
temp$ = "The user was too lazy to provide us any word lists to choose from, so this is the default choices which were insterted into the program by Steve, just because he wanted something to work with, even if the end user might be a smart ass like Pete pretends to be sometimes."
l = 0
l = 0
skipcheck:
i = 1
word$
= LEFT$(word$
, i
- 1) + MID$(word$
, i
+ 1) i = i + 1
newword = -1
u = u + 1
Words(u) = word$: WordCount(u) = 1
WordCount(i) = WordCount(i) + 1
oldl = l + 1
oldl = oldl + 1
WordCount(0) = u
FOR i
= 1 TO WordCount
(0) 'it doesn't fit our length criteria to be a "good word"
goodword = goodword + 1
Words(goodword) = Words(i)
WordCount(goodword) = WordCount(i)
WordCount(0) = goodword
'This is the routine I tend to use personally and promote.
'It's short, simple, and easy to implement into code.
gap = WordCount(0)
index = WordCount(0)
gap
= INT(gap
/ 1.247330925103979) i = 1
swapped = 0
IF Words
(i
) > Words
(i
+ gap
) THEN SWAP Words
(i
), Words
(i
+ gap
) SWAP WordCount
(i
), WordCount
(i
+ gap
) swapped = -1
i = i + 1
'This is the routine I tend to use personally and promote.
'It's short, simple, and easy to implement into code.
gap = WordCount(0)
index = WordCount(0)
gap
= INT(gap
/ 1.247330925103979) i = 1
swapped = 0
IF WordCount
(i
) > WordCount
(i
+ gap
) THEN SWAP Words
(i
), Words
(i
+ gap
) SWAP WordCount
(i
), WordCount
(i
+ gap
) swapped = -1
i = i + 1
So this loads a whole book for us, and then uses it to create a word list from all the words in the book, while also counting the word frequency. It then sorts our words by alphabetical order and frequency for us.
At this point, all one would need is to come up with a formula they like to generate various difficulty settings.
Personally, I'd go for something like: Frequency (guessing a word that appears once in a book is going to be a lot harder than guessing a word which appears thousands of times), modified by length of the word (very short words are hard to guess just because there's so many of them to choose from, and very long words are hard to guess just from lack of general familiarity with them), with a modifier for the number of letters used in the word. (
Subdermatoglyphic is a rare word, with a ton of letters, but it has 17 unique letters! There's not a lot of letters which you can actually guess and not have appear in it, in a game of hangman.)
So just choose a formula you like for a range of difficulty, and then you can make your game customizable so the user can play a Trivial, Easy, Average, Hard, or Impossible game... ;)