#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <ctype.h>
#include <fcntl.h>
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "assert.h"
#include "p_plain.h"
#include "score4.h"
#include "unmakemove.h"
#include "win_table.h"
Defines | |
| #define | P_LIMIT 0x8000 |
| Polynomial limit. | |
| #define | NTAB_SIZE (NUM_PLAINS * 9) |
| Size of n_table[] - (# of plains) x (# of permutations per trap). | |
Functions | |
| static void | _addentry (W_ENTRY *word) |
| Add an entry to n_table[]. | |
| static void | _exit (void) |
| Add entries in n_table[] to MEM_FILE. | |
| static int | _find_c_move (short plain) |
| Find move that results in a trap. | |
| static void | _init (void) |
| Perform initialization for learn_1(). | |
| static void | _permutations (int plain, W_ENTRY *word, int offset, int c_offset) |
| Generate all valid trap permutations from a given trap. | |
| static int | _plain_win (short plain) |
| Determine if a win is present in a plain. | |
| static int | _replay (W_ENTRY *word) |
| Replay the game withing a plain. | |
| void | learn_1 (void) |
| Learn from a loss. | |
Variables | |
| short | a_board_1 [] |
| Alpha board. | |
| short | b_board_1 [] |
| Beta board. | |
| MOVE | c_move_1 |
| Move chosen by Alpha. | |
| MOVE | o_move_1 |
| Move chosen by get_move(). Used by learn(). | |
| static W_ENTRY | n_table [NTAB_SIZE+1] |
| Table for new traps. | |
| static int | w_count |
| W count. | |
| static int | a_stones |
| A stones. | |
| static int | trap_found |
| Was addentry() called? | |
1.4.5