|
|
|
@ -82,17 +82,17 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
while( ( i==PTQ_FIRST_ENTRY ?
|
|
|
|
|
while( ( i==PQ_FIRST_ENTRY ?
|
|
|
|
|
(PQUEUE_MaxRating) /* return biggest possible rating if first element */
|
|
|
|
|
:
|
|
|
|
|
(PGetRating(Elements[ PTQ_PARENT_INDEX(i) ]) )
|
|
|
|
|
(PGetRating(Elements[ PQ_PARENT_INDEX(i) ]) )
|
|
|
|
|
)
|
|
|
|
|
< r
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
Elements[ i ] = Elements[ PTQ_PARENT_INDEX(i) ];
|
|
|
|
|
Elements[ i ] = Elements[ PQ_PARENT_INDEX(i) ];
|
|
|
|
|
|
|
|
|
|
i = PTQ_PARENT_INDEX(i);
|
|
|
|
|
i = PQ_PARENT_INDEX(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -132,7 +132,7 @@ void *freecell_solver_PQueuePop( PQUEUE *pq)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pMaxElement = Elements[PTQ_FIRST_ENTRY];
|
|
|
|
|
pMaxElement = Elements[PQ_FIRST_ENTRY];
|
|
|
|
|
|
|
|
|
|
/* get pointer to last element in tree */
|
|
|
|
|
pLastElement = Elements[ CurrentSize-- ];
|
|
|
|
@ -143,7 +143,7 @@ void *freecell_solver_PQueuePop( PQUEUE *pq)
|
|
|
|
|
|
|
|
|
|
/* UNTESTED */
|
|
|
|
|
|
|
|
|
|
for( i=PTQ_FIRST_ENTRY; (child = PTQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child )
|
|
|
|
|
for( i=PQ_FIRST_ENTRY; (child = PQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child )
|
|
|
|
|
{
|
|
|
|
|
/* set child to the smaller of the two children... */
|
|
|
|
|
|
|
|
|
|