CIT 591 Assignment 9: Three Musketeers
Fall 2009, David Matuszek
Purposes of this assignment:
- To give you more experience with program design
- To make you think carefully about program style
General idea of the assignment:
Write a program to play the game of Three
Musketeers.
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.
Your program should allow the game to be played in three different ways:
- Human vs. computer, where the human plays the three musketeers, and the computer plays Cardinal Richelieu's men.
- Human vs. computer, where the human plays Cardinal Richelieu's men, and the computer plays the three musketeers.
- Computer vs. computer, where the computer plays both sides.
You should work together with your partner to figure out how to structure the program, and to accept moves from the human.
- One of you should write the code for playing the three musketeers. This code should be in a separate class (at least one) with your name on it as the @author.
- One of you should write the code for playing Cardinal Richelieu's men. This code should be in a separate class (at least one) with your name on it as the @author.
This is a friendly competition between you and your partner. When you write code for your side, you should not just play randomly; you should try to win the game. Of course, you should still help each other as much as possible, but you might want to keep your strategy to yourself.
Advice
Remember that a good programmer is "creatively lazy." If you just start programming the first approach that comes to mind, you may be making things a lot more difficult for yourself. Even for a simple program like this, it's worthwhile to think about a couple of different ways you might organize the code, and choose the one that seems simplest. I know that many of you are too sure of yourselves to even try TDD, but it can help improve the structure of your program.
Grading
Your program should work. You should have Javadoc for
all public entities. You should have JUnit tests for all public methods in
your game, except those that do I/O. None of the code for deciding moves, either for the musketeers or for Cardinal Richelieu's men, should do any I/O.
In addition, this time your program will be graded heavily on style.
- Basic mechanical stuff:
- Did you follow the Java naming conventions?
- Did you avoid magic numbers?
- Is your program properly formatted and indented?
- Do you have Javadoc comments for all public entities?
- Less mechanical (but still routine) stuff:
- Did you use meaningful names for variables and methods?
- Does your Javadoc really provide enough information for someone to use
the methods?
- Are your methods short and single-purpose?
- Are your methods relatively independent (and therefore testable)?
- Do your instance variables really describe the object?
- Did you follow the DRY principle?
- Are your JUnit tests comprehensive?
- Fundamental, conceptual style:
- Does your program organization consist of appropriate kinds of objects?
- Do you make appropriate use of composition, inheritance, overloading,
and overriding?
- Are the responsibilities (methods) of each object type appropriate to
that object?
- Does your code do things in the simplest way possible?
Due date:
Midnight Thursday, November 19, via Blackboard.