Compsci 06, Spring 2011, Jotto Howto

Snarfing

This assignment provides some starter files you can use including two drivers for the Jotto program: one that interacts with the user on the command line and one that uses a graphical user interface or GUI to interact with the user. You'll write the program with which both of these drivers interact. The key here is that the program you write, called jottoModel, can be used with both user interfaces!

See snarfing help for information on how to use the Ambient/Snarf functionality in Eclipse. Note that the snarf URL for this semester is http://www.cs.duke.edu/courses/cps006/spring11/snarf

Overview

This assignment is about understanding global state/variables in a module and on how interactive programs, whether command-line or GUI-driven, communicate with a model. In general terms a model is one part of a program designed using what is called the model-view paradigm. The view is also the controller that runs the program. Sometimes software designers refer to model-view-controller which is a design based on three parts or modules. In this assignment there are two parts since the view/controller are wrapped into one module: either jottoMain.py for the command-line version or jottoGui.py for the GUI version. All code is in the code directory linked here.

Functions

In the jottoModel.py module you will need to add global state and implement the functions whose comments and signatures are provided. A function signature is its name, parameters, and return type. Read these descriptions carefully, but be prepared to fix mistakes as they arise since sometimes it is tricky to find errors when global variables are used.

Some of the functions will need to access (read) and sometimes alter (write) the different global state kept in the module. For example the load_words function is written for you and fills the global list _wordlist. This list will be used in start_game and possibly in other functions.

A/Extra Credit

There are many algorithms for removing words that can no longer be guessed from the total available words. The one given above is perhaps the simplest to implement, but it has no intelligence about the problem it is solving. You will receive extra credit for developing a "smarter" algorithm than the one above, i.e., one that takes fewer steps to guess your secret word. After every one has submitted a solution, we will play them against eachother in a tournament to see whose is the best guesser.