/*> h.movegen <*/
/*---------------------------------------------------------------------------*/
/*  Interface between scrabble move entry/display and the game code          */
/*---------------------------------------------------------------------------*/

typedef struct {
                int  rack_position ; /* position of tile in passed-in rack */
                char tile ;          /* tile - 'a'..'z', ' '               */
                char placed_letter ; /* 'a'..'z',  'A'..'Z'                */
                int  x ;             /* 0..14                              */
                int  y ;             /* 0..14                              */
               } move_info ;

/*---------------------------------------------------------------------------*/

/* boolean state (whether valid move found)
 * the following routines will recursively call the given wimp poll function
 * allowing higher level game functions (and other RISC OS applications)
 * a look-in... a suitable return code will notify the move code whether
 * a search sequence is to be terminated
 */
int find_move(
                  /* in */
                  char **board,              /* board[15][15] 'A'..'Z' '.' */
                  int    player,             /* 0..3                       */
                  int    tilecount,          /* 1..7                       */
                  char  *tilerack,           /* 0..6  "[a..z]" or " "      */
                  void  (*poll_function)(),    /* wimp poll routine          */
                  /* inout */
                  void  *player_info,        /* private object             */
                  /* out */
                  int   *tiles_placed,       /* 0..7                       */
                  move_info  *move_list,     /* move_list[0..6]            */
                  int   *actual_length,      /* 0..15                      */
                  char  *actual_word,        /* word[15] -- all lowercase  */
                  int   *actual_direction,   /* 0-horizontal, 1-vertical   */
                  int   *incidentals_formed, /* count of below: 0..15      */
                  char ***incidental_words,   /* array of ditto -- for info */
                  int   *actual_start_x,     /* Xpos of 1st letter         */
                  int   *actual_start_y,     /* Ypos of 1st letter         */
                  int   *placed_score        /* score of resulting word    */
                 ) ; 

/*---------------------------------------------------------------------------*/

/* Identical to find_move, but finds the move suggested by
 * the human player instead of looking for one.  Use '?' for
 * characters in fields you don't know such as 'tilerack';
 * expect other fields to be filled in if possible.
 */
int place(
              /* in */
              char **board,              /* board[15][15] 'a'..'z' '.'     */
              int    player,             /* 0..3                           */
              int    tilecount,          /* 1..7                           */
              char  *tilerack,
              void  (*poll_function)(),    /* poll routine called regularly  */
              /* inout */
              void  *player_info,        /* private object                 */
              /* In the case of 'Place', these are now 'in's...            */
              int   tiles_placed,       /* 0..7                           */
              move_info  *move_list,     /* move_list[0..6]                */
              /* in */
              int   *actual_length,      /* 0..15                          */
              char  *actual_word,        /* word[15] -- all lowercase      */
              int   *actual_direction,   /* 0-horizontal, 1-vertical       */
              int   *incidentals_formed, /* count of below: 0..15          */
              /* out */
              char ***incidental_words,   /* array of ditto -- for info     */
              int   *actual_start_x,     /* Xpos of 1st letter             */
              int   *actual_start_y,
              int   *placed_score        /* score of resulting word        */
             ) ;

/*---------------------------------------------------------------------------*/
/*> h.movegen <*/
