/*
   File:         pg.h
   Author:       Andrew W. Moore
   Created:      4th September 1992
   Description:  Header for PartiGame software. See pg.txt for
                 further information.

   Copyright (C) Andrew W. Moore, 1992
*/

typedef struct state_list_struct
{
  struct state_struct *state;
  struct state_list_struct *next;
} state_list;

typedef struct actions_struct
{
  int action_id;
  state_list *outcomes;
  struct state_struct *opponents_choice;
  char *data;
  struct actions_struct *next;
} actions;

typedef struct cost_struct
{
  bool winner;
  int steps;
} cost;

typedef struct state_struct
{
  int state_id;
  actions *actions;
  char *data;       /* Information for user of pgame */
  cost cost;
  actions *best;    /* Computed by game search */
  state_list *preds;/* Computed by pred finder */
} state;

typedef struct pgame_struct
{
  int number_states;
  state_list *states;
  state *goal;            /* Also in states */
} pgame;

extern float cost_to_float();                 /* (co) */
extern bool less_cost();                      /* (c1,c2) */
extern bool same_cost();                      /* (c1,c2) */
extern void copy_cost();                      /* (c1,c2) */
extern bool is_winner();                      /* (co) */
extern void set_loser_cost();                 /* (co) */

extern state *find_state();                   /* (stl,state_id) */
extern actions *find_action();                /* (acs,action_id) */
extern state_list *find_outcomes_node();      /* (outs,next_state,res_prev) */
extern void fprint_state();                   /* (s,m,st,verbosity) */
extern void fprint_pgame();                   /* (s,m,pg,verbosity) */
extern state *add_state_to_pgame();           /* (pg,data) */
extern actions *add_action_to_state();        /* (st,data) */
extern void set_goal();                       /* (pg,st) */
extern void maybe_include_action_outcome();   /* (ac,next_state) */
extern void free_pgame_contents();            /* (pg) */
extern void pred_finder();                    /* (pg) */
extern void init_pgame();                     /* (pg) */
extern void solve_pgame();                    /* (pg) */
extern void remove_outcome_and_pred();        /* (src_st,ac,dest_st) */
extern void new_outcome_and_pred();           /* (src_st,ac,dest_st) */

