Compsci 101 Fall 2012, 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 jotto_model, 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/fall12/compsci101/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 jotto_commandline.py for the command-line version or jotto_gui.py for the GUI version. All code is in the code directory linked here.

Functions

In the jotto_model.py module you will need to add global state and implement the functions whose comments and signatures are provided in the file and described here. 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 as well.