Homework 4. Stat 540 Spring 1999.
This homework will be checked, at 5:00pm on Thursday 11th February.
The objective of this homework is to construct a working Mastermind
program, which will run over the WEB by using the HTTP and CGI protocols.
Game components
- The game should use 6 colors in the secret code.
- The game should offer the user 6 goes to guess the code.
- The game should allow the user to input their guess for the secret code.
- After each guess, the program should report to the user 2 numbers;
- 1. The number of colors guessed correctly and in the correct place.
- 2. The number of colors guessed correctly but in the wrong place.
- The game should display a game board which shows all previous guesses, and the outcome of each guess.
- The game should offer the user the ability to quit a
game half way through and request the secret code.
- Outcomes:
- If the user guesses correctly the program should report this!
- If the user fails to guess correctly after 6 attempts the program should inform the user of this, and return the secret code.
- The user should have the ability to reset a game half
way through.
Deliverables
- Your program schematic (either emailed or put in my mailbox).
- Your program, which I should find a link to in
/home/userid/public_html/Stat540s99/homework04/homework04.html
and the program itself as
/home/userid/public_html/cgi-bin/master.pl
Considerations
- Use cookies to store state information.
- Test your program by throwing some "crazy inputs" at it, to get an idea
of its robustness.
- Make sure that it acts appropriately under the three conditions, win,
lose and reset.
- Suggestion: build the code up slowly. Structure your efforts along the
lines of subroutines, state information, program flow, interface.
- Debugging. This is a pain for CGI programs. Remember that you can always
run your Perl script from the command line. You can include copious numbers
of print statements in your code to check the status of variables. Check out the simple DEBUG device.
Collaboration
This homework may be done as a team. Teams should have at most 3 people.
Let me know who's in your team.
Richard Waterman. Fri Feb 5 06:20:05 EST 1999.