CIT 590 Assignment 3: Three Musketeers
  Fall 2016, David Matuszek

Purposes of this assignment

General idea of the assignment

Write a program to play the game of Three Musketeers--human against computer.

You have probably never heard of this game. That's okay, the rules are simple--that's why I chose it. The link above is to a Wikipedia article that explains the game, and I can answer questions if necessary. It also happens to be a pretty good game.


Get starter files

Copy the files and to your computer.

Writing tests first

It is better to write the tests before writing the code to be tested. Since in this assignment I'm providing stubs for both methods and their tests, this is an easy time to try doing things the recommended way.

I have an entire writeup on Test-Driven Design (TDD), but here's the capsule version:

  pick a method that doesn't depend on other, untested methods
  while the method isn't complete:
      write a test for the desired feature
      run all tests and make sure the new one fails
      while any test fails:
          add/fix just enough code to try to pass the tests
      refactor the code to make it cleaner

About the provided code

See the Wikipedia article for the rules of the game.

The "board" is represented as a list of five lists; each of these lists represents a row, and each list contains five elements. The first list represents the first row; the first element in each list represents the first column. The values in the list must each be one of three things: an 'M', representing a Musketeer, an 'R', representing one of Cardinal Richelieu's men; and a '-', representing an empty space. board is the one and only global variable in this program.

Directions are given as one of the four strings 'left', 'right', 'up', and 'down'.

Your job is to complete the program,  both and

Some brief Python reminders

Here are some Python things to remember:

The computer does not have to play a great game--it does have to play legally. However, if the computer plays stupidly, it won't be much fun. If you would like to implement a simple strategy, here's a start:

Don't spend any more time than necessary on strategy until after the program is working!

Due date

Zip your two files and turn them in to Canvas before 11:59pm Tuesday, September 20.