|
|
|
@ -11,8 +11,8 @@
|
|
|
|
|
http://www.geocities.com/jheyesjones/astar.html
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef FC_SOLVE__PTQUEUE_H
|
|
|
|
|
#define FC_SOLVE__PTQUEUE_H
|
|
|
|
|
#ifndef FC_SOLVE__PQUEUE_H
|
|
|
|
|
#define FC_SOLVE__PQUEUE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
@ -22,7 +22,7 @@ extern "C" {
|
|
|
|
|
|
|
|
|
|
#include "jhjtypes.h"
|
|
|
|
|
|
|
|
|
|
#define PTQUEUE_MaxRating INT_MAX
|
|
|
|
|
#define PQUEUE_MaxRating INT_MAX
|
|
|
|
|
|
|
|
|
|
typedef int32 pq_rating_t;
|
|
|
|
|
|
|
|
|
@ -32,13 +32,13 @@ typedef struct struct_pq_element_t
|
|
|
|
|
pq_rating_t rating;
|
|
|
|
|
} pq_element_t;
|
|
|
|
|
|
|
|
|
|
typedef struct _PTQUEUE
|
|
|
|
|
typedef struct _PQUEUE
|
|
|
|
|
{
|
|
|
|
|
int32 MaxSize;
|
|
|
|
|
int32 CurrentSize;
|
|
|
|
|
pq_element_t * Elements; /* pointer to void pointers */
|
|
|
|
|
pq_rating_t MaxRating; /* biggest element possible */
|
|
|
|
|
} PTQUEUE;
|
|
|
|
|
} PQUEUE;
|
|
|
|
|
|
|
|
|
|
/* given an index to any element in a binary tree stored in a linear array with the root at 1 and
|
|
|
|
|
a "sentinel" value at 0 these macros are useful in making the code clearer */
|
|
|
|
@ -52,15 +52,15 @@ typedef struct _PTQUEUE
|
|
|
|
|
#define PTQ_RIGHT_CHILD_INDEX(i) (((i)<<1)+1)
|
|
|
|
|
|
|
|
|
|
void freecell_solver_PQueueInitialise(
|
|
|
|
|
PTQUEUE *pq,
|
|
|
|
|
PQUEUE *pq,
|
|
|
|
|
int32 MaxElements
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
void freecell_solver_PQueueFree( PTQUEUE *pq );
|
|
|
|
|
void freecell_solver_PQueueFree( PQUEUE *pq );
|
|
|
|
|
|
|
|
|
|
int freecell_solver_PQueuePush( PTQUEUE *pq, void *item, pq_rating_t);
|
|
|
|
|
int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t);
|
|
|
|
|
|
|
|
|
|
void *freecell_solver_PQueuePop( PTQUEUE *pq);
|
|
|
|
|
void *freecell_solver_PQueuePop( PQUEUE *pq);
|
|
|
|
|
|
|
|
|
|
#define PGetRating(elem) ((elem).rating)
|
|
|
|
|
|
|
|
|
@ -68,4 +68,4 @@ void *freecell_solver_PQueuePop( PTQUEUE *pq);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* #ifdef FC_SOLVE__PTQUEUE_H */
|
|
|
|
|
#endif /* #ifdef FC_SOLVE__PQUEUE_H */
|
|
|
|
|