Nov 97 Challenge
Volume Number: 13
Issue Number: 11
Column Tag: Programmer's Challenge
by Bob Boonstra, Westford, MA
Pente®
Reaching once again into the closet where we store board games, I found the game of
Pente®, The board physically resembles the board used in GO, but the game strategies
are simpler. Pente® is played by two players who alternate placing stones on a 19x19
grid. The objective is to win the game by getting five or more stones in a row or,
alternatively, by capturing five or more pairs of your opponent's stones. Your
Challenge is to write code that will play the game of Pente® and accumulate the most
points (described below) in the minimum time. The prototype for the code you should
write is:
typedef struct Capture {
Point stone1;
Point stone2;
} Capture;
void InitPente(
long boardHalfSize /* e.g., 9 for a 19x19 board */
/* all coordinates between -boardHalfSize
and +boardHalfSize */
);
void Pente(
Point opponentsMove, /* your opponent moved here */
Boolean playingFirst, /* ignore opponentMove */
Point *yourMove, /* return your move here */