The snarf url for this CompiSci 100 is http://www.cs.duke.edu/courses/spring12/fall11/snarf/.
We wrote code to call HangmanLoader.getRandomWord 10,000
times for word-lengths of 4-10. The results of one run are below.
| word length | # words |
|---|---|
| 4 | 2209 |
| 5 | 3792 |
| 6 | 4959 |
| 7 | 5412 |
| 8 | 5379 |
| 9 | 4947 |
| 10 | 4059 |
If run again, the numbers above will be similar, but different. You'll need to decide on a strategy and code to get estimates of the number of different words for each word-length from 4-20 (inclusive).
In your assignment writeup you'll explain your methodology and include data about your conclusions. You're welcome to create and use charts, tables, etc. Please submit a pdf for your analytical writeup.
You should include the code you wrote to create your statistical analysis and explain how you ran the code to get the data you use in your analysis.
You are provided with four classes.
public static void main(String args[]) that executes the
code in the class.
public static void main(String
args[]) function that is the starting point of the Hangman game
you write.
It creates a HangmanGame and invokes the play
method.
You can write the game without modifying
HangmanExecuter--if you do modify it, please include an
explanation in your README.
play method and you may add new methods
or state/instance variables to this class.
Expect to spend some time getting used to the Java language. You should read pages 8-35 of your textbook. We have written a handy-dandy cheat sheet that shows example java code and matches it to Python and Matlab. The Java API docs provide info on what sort of operations Strings or other objects support. Using google can also work.
The sample output on the assignment writeup page should be generically followed in that the user should see a representation of the secret word with guesses filled in, the letters used so far, and so on.