summaryrefslogtreecommitdiffstats
path: root/kpat/freecell-solver/pqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'kpat/freecell-solver/pqueue.c')
-rw-r--r--kpat/freecell-solver/pqueue.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/kpat/freecell-solver/pqueue.c b/kpat/freecell-solver/pqueue.c
index 086cce96..7cacf8ff 100644
--- a/kpat/freecell-solver/pqueue.c
+++ b/kpat/freecell-solver/pqueue.c
@@ -33,7 +33,7 @@
the list is sorted ascending or descending... */
void freecell_solver_PQueueInitialise(
- PQUEUE *pq,
+ PTQUEUE *pq,
int32 MaxElements
)
{
@@ -53,7 +53,7 @@ void freecell_solver_PQueueInitialise(
returns TRUE if successful, FALSE if fails. (You fail by filling the pqueue.)
PGetRating is a function which returns the rating of the item you're adding for sorting purposes */
-int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
+int freecell_solver_PQueuePush( PTQUEUE *pq, void *item, pq_rating_t r)
{
uint32 i;
pq_element_t * Elements = pq->Elements;
@@ -73,7 +73,7 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
i = (++CurrentSize);
- /* while the parent of the space we're putting the new node into is worse than
+ /* while the tqparent of the space we're putting the new node into is worse than
our new node, swap the space with the worse node. We keep doing that until we
get to a worse node or until we get to the top
@@ -82,17 +82,17 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
{
- while( ( i==PQ_FIRST_ENTRY ?
- (PQUEUE_MaxRating) /* return biggest possible rating if first element */
+ while( ( i==PTQ_FIRST_ENTRY ?
+ (PTQUEUE_MaxRating) /* return biggest possible rating if first element */
:
- (PGetRating(Elements[ PQ_PARENT_INDEX(i) ]) )
+ (PGetRating(Elements[ PTQ_PARENT_INDEX(i) ]) )
)
< r
)
{
- Elements[ i ] = Elements[ PQ_PARENT_INDEX(i) ];
+ Elements[ i ] = Elements[ PTQ_PARENT_INDEX(i) ];
- i = PQ_PARENT_INDEX(i);
+ i = PTQ_PARENT_INDEX(i);
}
}
@@ -110,14 +110,14 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
#define PQueueIsEmpty(pq) ((pq)->CurrentSize == 0)
/* free up memory for pqueue */
-void freecell_solver_PQueueFree( PQUEUE *pq )
+void freecell_solver_PQueueFree( PTQUEUE *pq )
{
free( pq->Elements );
}
/* remove the first node from the pqueue and provide a pointer to it */
-void *freecell_solver_PQueuePop( PQUEUE *pq)
+void *freecell_solver_PQueuePop( PTQUEUE *pq)
{
int32 i;
int32 child;
@@ -132,7 +132,7 @@ void *freecell_solver_PQueuePop( PQUEUE *pq)
return NULL;
}
- pMaxElement = Elements[PQ_FIRST_ENTRY];
+ pMaxElement = Elements[PTQ_FIRST_ENTRY];
/* get pointer to last element in tree */
pLastElement = Elements[ CurrentSize-- ];
@@ -143,9 +143,9 @@ void *freecell_solver_PQueuePop( PQUEUE *pq)
/* UNTESTED */
- for( i=PQ_FIRST_ENTRY; (child = PQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child )
+ for( i=PTQ_FIRST_ENTRY; (child = PTQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child )
{
- /* set child to the smaller of the two children... */
+ /* set child to the smaller of the two tqchildren... */
if( (child != CurrentSize) &&
(PGetRating(Elements[child + 1]) > PGetRating(Elements[child])) )