CS21 Lab 7: 3square (Top-Down Design)

Design is due Saturday, November 4, before midnight

Full implementation due Saturday, November 11, before midnight

Please read through the entire lab before starting! Also, as always, run update21 to create your cs21/labs/07 directory. Create your programs for lab 7 in this directory. Note that this is a two-part lab, split over two weeks.

For the first week you will focus on using top-down design to create the overall structure of the program. Once your proposed structured has been reviewed and approved by your professor, you will use bottom-up implementation and unit testing to complete the full program.

You have two weeks to complete the full program. The first week is for the design, and the second for the full game. Your initial top-down design is due this Saturday (Nov 4) and the full implementation the following week (Nov 11). It is highly recommended that you submit your top-down design a few days before the due date so that we have time to give you feedback, before you start your full game implementation. If you submit your design on Sat, Nov 4, at midnight, it might take us a few days get to it and send you comments on your design.

See below for the design requirements.


When my kids were younger, it was always a challenge to keep them occupied (i.e., not screaming and kicking) in a restaurant, while waiting for the food to arrive. We used to play word games on the napkins, and one of our favorites was making and solving 3x3 word squares, like this:

  1. young canine
  2. one in Spanish
  3. used for cooking

The clues above are for the words. If there are three clues, that means the words are all three letters long. And each word must fit both horizontally and vertically in a 3x3 box (i.e., word 1 fills in row 1 and column 1 of the box, word 2 fills row 2 and column 2, etc). Here's the solution for the above puzzle (note: we are not using graphics for this lab...all output is just to the terminal):

The goal is to solve the word square, given the clues. Our program will read the clues and answers from a file, present the clues to the user, and allow them to solve the puzzle by making guesses for each word.

Examples, Requirements, and Tips

Here are a few examples of the running program, to help you see how things should work. Pay attention to how the game proceeds, and how input from the user is handled.

You have some freedom in how you want your game to look. Here are our requirements for the game:

Top-Down Design Requirements

You should complete your top-down design (TDD), submit it, and obtain feedback on it before beginning the full game implementation. Special procedures for this two-week lab:

Here is a simple example of a top-down design.

And here is an example of a running 3square top-down design.
Your design doesn't have to match this exactly, but should allow the user to input some choices, and should show the (fake) game progress.

Extra Challenges (no points...just for fun, if you have time)

I enjoy making the puzzles as much as solving them. Try making your own puzzle.txt files (puzzle1.txt, puzzle2.txt, etc). Allow the user to input the puzzle file name, or ask them if they want to play again and use a different file.

Or create a 4x4 puzzle, and modify your program to work with both 3x3 and 4x4 puzzles.

Answer the Questionnaire

After you have turned in the full program, please edit the QUESTIONS-07.txt file in your cs21/labs/07 directory and answer the questions in that file.

Turning in your labs....

For this lab, run handin21 to turn in your design and then send your lecture professor a quick email letting them know you turned in your design. We will take a look at each design and send you comments (usually within a day or two). Once you have our comments, copy the file (cp design-3square.py 3square.py), finish implementing the game (in 3square.py) and then run handin21 again.