home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / BM_STAR.ZIP / SOURCE.ZIP / ASTAR.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-27  |  1.8 KB  |  47 lines

  1. /*////////////////////////////////////////////////////
  2. // astar.h
  3. // 27jul92-bm
  4. *****************************************************/
  5. typedef  unsigned int UINT;
  6.  
  7. #define  HASH_SIZE      161     /* primary hash table size*/
  8. #define  FN_MAX         199     /* range of heuristic costs*/
  9. #define  YES            1
  10. #define  NO             0
  11. #define  NIX            -1
  12. #define  INVALID        -1
  13. #define  PW             4       /* puzzle width */
  14. #define  PSIZE          PW * PW /* puzzle size */
  15. #define  POLES          4       /* North,South,East,West */
  16. #define  HOLE           '-'     /* place to move into */
  17. #define  FORWARD        0       /* search S->G */
  18. #define  REVERSE        1       /* search G->S */
  19. /* solution types */
  20. #define  StoG           1       /* if goal on down search */
  21. #define  GtoS           2       /* if goal on 1st up search */
  22. #define  GtoS_COM       3       /* if common node on up search */
  23. #define  GtoS_K1        4       /* if goal on 2nd up search */
  24. #define  GtoS_K1_COM    5       /* if common node on 2nd up search */
  25.  
  26. typedef struct lnode *NPTR;     /* node pointer */
  27. struct lnode
  28.   { NPTR  Next;                 /* pointer to next node */
  29.         int Num;            /* node number */
  30.     char *Dptr;             /* pointer to data store */
  31.   } ;                           /* : use cast if not char */
  32.  
  33. typedef struct
  34. { unsigned int
  35.     Gn,                 /* cost from source to n */
  36.     Hn,                 /* estimated cost to goal */
  37.     Dad;                /* nodenum of parent node */
  38.     char Puz[PSIZE+1];  /* string representation of puzzle */
  39. } PUZZLE ;
  40.  
  41. NPTR   DropLinked( NPTR Head );
  42. NPTR   MakeLink( char *DataPtr, unsigned Info );
  43. NPTR   PopLink( NPTR *Head );
  44. NPTR   PushLink( NPTR Head, NPTR New );
  45. void   ReleaseNodes( void );
  46.  
  47.