~ubuntu-branches/ubuntu/natty/freecell-solver/natty

« back to all changes in this revision

Viewing changes to pqueue.h

  • Committer: Bazaar Package Importer
  • Author(s): RISKO Gergely
  • Date: 2005-03-30 20:12:47 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050330201247-8qdt6jhg7kxr3gjy
Tags: 2.8.10-1
* New upstream release
* fixed override disparity

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
extern "C" {
19
19
#endif
20
20
 
 
21
#include <limits.h>
 
22
 
21
23
#include "jhjtypes.h"
22
24
 
 
25
#define PQUEUE_MaxRating INT_MAX
 
26
 
23
27
typedef int32 pq_rating_t;
24
28
 
25
29
typedef struct struct_pq_element_t
34
38
    int32 CurrentSize;
35
39
    pq_element_t * Elements; /* pointer to void pointers */
36
40
    pq_rating_t MaxRating; /* biggest element possible */
37
 
    int IsAscendingHeap; /* true if the heap should be sorted with the maximum scoring elements first */
38
41
} PQUEUE;
39
42
 
40
43
/* given an index to any element in a binary tree stored in a linear array with the root at 1 and
46
49
 
47
50
/* left and right children are index * 2 and (index * 2) +1 respectively */
48
51
#define PQ_LEFT_CHILD_INDEX(i) ((i)<<1)
49
 
#define PQ_RIGHT_CHILD_INDEX(i) (((i)<<)+1)
 
52
#define PQ_RIGHT_CHILD_INDEX(i) (((i)<<1)+1)
50
53
 
51
54
void freecell_solver_PQueueInitialise(
52
55
    PQUEUE *pq,
53
 
    int32 MaxElements,
54
 
    pq_rating_t MaxRating,
55
 
    int bIsAscending
 
56
    int32 MaxElements
56
57
    );
57
58
 
58
59
void freecell_solver_PQueueFree( PQUEUE *pq );
59
60
 
60
61
int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t);
61
62
 
62
 
int freecell_solver_PQueueIsEmpty( PQUEUE *pq );
63
 
 
64
63
void *freecell_solver_PQueuePop( PQUEUE *pq);
65
64
 
66
65
#define PGetRating(elem) ((elem).rating)