Rice University - Comp 212 - Intermediate Programming

Fall 2003

Lab #6- Hangman's Word - Introduction to the Model-View-Controller Design Pattern

This is the start of Project 1, which involves multiple assignments and due dates.


1. Playing Hangman

Let's play hangman

Game Interactions

Word Display

Scaffold Display

Computer displays a word for the user to guess and an "empty" scaffold. _ _ _ _ _ Scaffold with no body parts.
User guesses 'X':    
Computer displays: _ _ _ _ _ Scaffold with a head
User guesses 'E':    
Computer displays: _ _ _ _ _ Scaffold with a head and a torso
User guesses 'A'    
Computer displays: _ _ _ _ A Scaffold with a head, and a torso
User guesses 'R'    
Computer displays: _ _ _ _ A Scaffold with a head, a torso, and a right arm
etc...    
     

We are to write a program that plays hangman as shown.  What are the components of such a program?

At a very high level, the program 

The above functionalities of the program must be delineated and encapsulated in separate components in order to achieve a high degree of flexibility and extensibility.  A tried-and-true design pattern, called Model-View-Controller (MVC), is best suited for programs like the above.

2. Model-View-Controller Paradigm

The MVC design pattern calls for breaking up programs that interact with the users and display the results based on the users'  inputs into three major components.

3. Hangman's Model - Yet Another Mutable Linear Recursive Structure

What data structures do we need for Hangman?

 Let's take a look at the hangman project description.

One of the key data structures for this program is a linear recursive structure similar to that of a list to store the characters of a word to be guessed.  A detailed description of this data structure is given at the link: ../../projects/hangman/wordlist.html, Go to this link and follow the directions that are there.  By completing the exercises in this link, you will have completed a non-trivial part of the programming project.

Your labbies will give you guidance but will not help you write the code.   


dxnguyen@cs.rice.edu
Copyright 2003, Dung X. Nguyen - All rights reserved.