1 /*
2  *                               Alizarin Tetris
3  * Interfaces relating to AI players.
4  *
5  * Copyright 2000, Westley Weimer & Kiri Wagstaff
6  */
7 #ifndef __AI_H
8 #define __AI_H
9 
10 #include "grid.h"
11 #include "piece.h"
12 
13 /* These are the possible commands an AI (or a player) can issue with
14  * respect to the currently falling piece.
15  */
16 typedef enum {
17     MOVE_NONE		= 0,
18     MOVE_LEFT		= 1,
19     MOVE_RIGHT		= 2,
20     MOVE_ROTATE		= 3,
21     MOVE_DOWN		= 4,
22 } Command;
23 
24 /* An AI player has a name and must implement these three functions. */
25 typedef struct AI_Player_struct {
26     char *name;
27     char *msg;
28     Command (*move)(void *state, Grid *, play_piece *, play_piece *,
29 		    int , int , int );
30     void (*think)  (void *state, Grid *, play_piece *, play_piece *,
31 		    int , int , int );
32     void * (*reset)  (void *state, Grid *);
33     int delay_factor;
34 } AI_Player;
35 
36 typedef struct AI_Players_struct {
37     int n;
38     AI_Player	*player;
39 } AI_Players;
40 
41 #endif
42