Files | |
| file | score4.c |
| Play a game of Score Four against a human - source file. | |
Defines | |
| #define | BUF_SIZE 512 |
| Buffer size. | |
Functions | |
| static void | _get_move (int move) |
| Get the user's next move. | |
| static void | _info (int argc, char *argv[]) |
| Parse user supplied options. | |
| static void | _init (void) |
| Perform initialization for Score Four. | |
| static void | _play (void) |
| Referee a game of Score Four between computer and human. | |
| static void | _usage (void) |
| Print usage message for Score Four. | |
Variables | |
| static int | user_first |
| Does the user go first? | |
| static int | total_time |
| Non-zero -> total time used to make moves. | |
| static int | max_time |
| Maximum time used by heuristic to make moves. | |
The board is split into two boards - on each for Alpha and Beta. a_board_1 represents the moves made by Alpha. b_board_1 represents the moves made by Beta. There are NUM_PLAINS different plains in a cube. For Score4, each plain is (4 X 4), so each board is acutally an array of NUM_PLAINS shorts, with each move being one bit in a short. So the first move on a plain would be a value of 1. The second move, a value of 2, and so on. This board representation is redundant but it better facilitates the heuristics.
usage: score4 [-a] [-d] [-h] [-n] [-o] [-p] [-t 1|2] [-x] [-y]
-a : use aggression with polynomial.
-d : debug.
-h : don't display help message.
-n : computer gets first turn.
-o : user uses 'O's.
-p : apply polynomial heuristic.
-s : print time info on computer moves.
-t : apply trap heuristic (1 or 2).
-y : user gets first turn.
-x : user uses 'X's.
|
|
Buffer size.
|
|
|
Get the user's next move.
|
|
||||||||||||
|
Parse user supplied options.
|
|
|
Perform initialization for Score Four.
|
|
|
Referee a game of Score Four between computer and human.
|
|
|
Print usage message for Score Four.
|
|
|
Maximum time used by heuristic to make moves.
|
|
|
Non-zero -> total time used to make moves.
|
|
|
Does the user go first?
|
1.4.5