Snarf the code via Eclipse/Ambient using twentyq, or browse the code directory online. The snarf URL is http://www.cs.duke.edu/courses/cps100/fall09/snarf
For this assignment you'll write a program that permits the user to play a dynamic version of twenty questions --- dynamic in the sense that the user can add new questions, save the game, then replay the game with the new questions.
In this assignment all questions have "yes/no" answers, more sophisticated options aren't part of the game.
You can see a video of someone playing a final version of the game to see how the GUI works. You're given the GUI for the game and you'll have to complete the model by writing code using binary trees. You can see that other people write such programs by looking at this question via Stackoverflow.
For infomation about an old TV show named 20 Questions see this Wikipedia article and this link for a technical article on playing twenty questions with a liar.
main method
in the GameMain.java
class. Until you complete the model, however, the game won't
be complete. When you've completed writing code for the game,
it may look like the screenshots in the howto. These screenshots show you
how the game will be played. You must read and store a tree before
the game is operational.
Use the File menu to load a file provided to you, create a new file, or
use the "load URL" to visite the class website for many files
representing games. When you download the project you get a simple file
animal.txt about which you can find more
information
in the howto pages.
You won't be able to use the
yes/no buttons or the newgame menu until you call
myView.setEnabled(true) from the model, presumabely
after you've loaded file. Without such a call the buttons
and menu-item will be grayed-out or disabled until then.
Consult the howto pages for a sequence of screen shots and more information on playing the game.
The game is dynamic in supporting the addition of new knowledge and the use of this knowledge in subsequent games. The howto pages show a sequence of screen shots with a complete explanation of how your game should support the addition of new knowledge.
AnimalGameModel as
described in the howto pages.
Most
of the control aspects of the program are already incorporated into
the class AnimalGameViewer that is similar
to previous view (e.g., Markov) implementations we've seen in other programs.
You'll need to implement the AnimalGameModel class
so that it works together with the view similarly to the other
MVC programs you've worked on this previously. The model is
described in the howto pages.
More details on the I/O and pre-order traversals can be found in the howto pages.
This assignment is worth 40 points, the breakdown is as follows:
| functionality | points |
|---|---|
| read/save file to play | 10 |
| play game/add info to tree | 10 |
| style of game and code | 10 |
| data file created | 5 |
| README | 5 |
For style of game and code, the user should see the path of the game, e.g., yes/no when deciding on new knowledge -- that's part of style of game. For style of code, be sure to include your name in the comments, be sure to write readable code, and so on.
You must also submit a README file in which you list all the people with whom you collaborated, and the TAs/UTAs you consulted with. You should include an estimated of how long you spent on the program and what your thoughts are about the assignment.
You must create a sample data file whose name indicates something about its contents. The questions should be yes/no questions about any topic, e.g., animals, elements from the periodic table, courses at Duke, and so on.
You should upload the file you create using the this web page which is netid-authenticated and which generates a file read by the view to allow all game-files to be shared among the class.
Submit via eclipse using twentyq.