[an error occurred while processing this directive]
CMSC201
Programming
Project Five
Mini Renju
out Thursday 11/21/96
due Tuesday 12/10/96
at Midnight
|
|
Objective
The purpose of this assignment is to give you experience writing an
interactibe program with a command line interface, using scanf for
input, and using arrays.
Your assignment
Write a program to play "mini-Renju", a game loosely based on the
Japanese game of five-in-a-row or Renju .
The game will be played on a grid of 10 by 10 intersections with black
or white stones placed on the intersections. Play alternates between
one player who starts the game (Black, by Renju convention) and
another player (White). A player can place a stone on any empty
intersection. The first player to get an unbroken line of three
stones whether vertically, horizontally, or diagonally, wins the game.
The commands
Your command-line interface should be able to handle the following
commands
- ?, h, H, help, HELP Print out a list of recognized
commands with a one-line description of each.
- p, P Print the current board.
- m Place a stone on the intersection at row
and Column .
- u, undo Undo the last move for both players.
- r, resign Submit and prepare to be assimilated.
Representing the board
Use a 10x10 array of integers with 0 representing an empty
intersection, -1 for a black stone and +1 for a white stone.
Or maybe the center part of a 16x16 board?
Is the game over?
One thing your program will have to do is to recognize when it has won
or its oponent has won or if there are no more moves that can be made.
How can you tell if the last stone that was played results in a win?
Check if any line of four stones of the same color go through it.
There are only sixteen possibilites to check.
For example, consider the following algorithm:
A W stone has just been placed at location R,C.
...
What's a good move?
Possible heuristics, in order of increasing power:
- Randomly try intersections until you find one that is empty.
- Remember the location of the last stone you played and that your
opponent played. Try to play a stone adjacent to your last mark if
possible. If not, play next to the last stone your opponent's.
- Place a stone to block a winning move by your opponent. If there
are none, place a stone to lengthen your longest run.
Total Quality Management
How to test your program. How we will test your program. How we will
evaluate your program.
Hints
Be sure to check this section from time to time for comments, hints
and clarifications added after the initial release of this assignment.
[an error occurred while processing this directive]
Friday, 03-Jan-1997 12:27:57 EST