summaryrefslogtreecommitdiffstats
path: root/kpat/freecell-solver
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /kpat/freecell-solver
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpat/freecell-solver')
-rw-r--r--kpat/freecell-solver/USAGE34
-rw-r--r--kpat/freecell-solver/caas.c14
-rw-r--r--kpat/freecell-solver/fcs.h8
-rw-r--r--kpat/freecell-solver/fcs_hash.c12
-rw-r--r--kpat/freecell-solver/fcs_hash.h4
-rw-r--r--kpat/freecell-solver/fcs_user.h2
-rw-r--r--kpat/freecell-solver/freecell.c12
-rw-r--r--kpat/freecell-solver/intrface.c12
-rw-r--r--kpat/freecell-solver/lib.c4
-rw-r--r--kpat/freecell-solver/lookup2.c2
-rw-r--r--kpat/freecell-solver/main.c42
-rw-r--r--kpat/freecell-solver/pqueue.c26
-rw-r--r--kpat/freecell-solver/pqueue.h32
-rw-r--r--kpat/freecell-solver/preset.c2
-rw-r--r--kpat/freecell-solver/scans.c20
-rw-r--r--kpat/freecell-solver/simpsim.c60
-rw-r--r--kpat/freecell-solver/state.h14
-rw-r--r--kpat/freecell-solver/test_arr.h28
-rw-r--r--kpat/freecell-solver/tests.h18
19 files changed, 173 insertions, 173 deletions
diff --git a/kpat/freecell-solver/USAGE b/kpat/freecell-solver/USAGE
index f78295b2..583624ca 100644
--- a/kpat/freecell-solver/USAGE
+++ b/kpat/freecell-solver/USAGE
@@ -67,7 +67,7 @@ program with some effort on the programmer's part.
This option will display the moves in standard notation in which every
move consists of two characters and there are ten moves in a line. Naturally,
-this option will only become apparent if the display moves is specified.
+this option will only become aptqparent if the display moves is specified.
(it does not implicitly specify it, though).
For more information regarding standard notation refer to the following
@@ -89,7 +89,7 @@ are needed to move from one to another. The standard notation
option applies to it to.
--pi --display-parent-iter
+-pi --display-tqparent-iter
This option (assuming the -s and -i options are specified) will also
display the iteration index of the state from which the current state
@@ -217,34 +217,34 @@ Freecell Tests:
'2' - put freecell cards on top of stacks.
'3' - put non-top stack cards in the foundations.
'4' - move stack cards to different stacks.
-'5' - move stack cards to a parent card on the same stack.
+'5' - move stack cards to a tqparent card on the same stack.
'6' - move sequences of cards onto free stacks.
'7' - put freecell cards on empty stacks.
-'8' - move cards to a different parent.
+'8' - move cards to a different tqparent.
'9' - empty an entire stack into the freecells.
Atomic Freecell Tests:
'A' - move a stack card to an empty stack.
-'B' - move a stack card to a parent on a different stack.
+'B' - move a stack card to a tqparent on a different stack.
'C' - move a stack card to a freecell.
-'D' - move a freecell card to a parent.
+'D' - move a freecell card to a tqparent.
'E' - move a freecell card to an empty stack.
Simple Simon Tests:
'a' - move a full sequence to the foundations.
-'b' - move a sequence to a true parent of his.
-'c' - move a whole stack sequence to a false parent (in order to clear
+'b' - move a sequence to a true tqparent of his.
+'c' - move a whole stack sequence to a false tqparent (in order to clear
the stack)
-'d' - move a sequence to a true parent that has some cards above it.
-'e' - move a sequence with some cards above it to a true parent.
-'f' - move a sequence with a junk sequence above it to a true parent that
+'d' - move a sequence to a true tqparent that has some cards above it.
+'e' - move a sequence with some cards above it to a true tqparent.
+'f' - move a sequence with a junk sequence above it to a true tqparent that
has some cards above it.
-'g' - move a whole stack sequence to a false parent which has some
+'g' - move a whole stack sequence to a false tqparent which has some
cards above it.
-'h' - move a sequence to a parent on the same stack.
+'h' - move a sequence to a tqparent on the same stack.
Manipulating the tests order can be very helpful to the quick solution
of a given board. If you found that a certain board cannot be solved in
@@ -259,7 +259,7 @@ Also note that Freecell tests are not suitable for solving Simple Simon games
and Simple Simon tests are not suitable for solving anything except Simple
Simon.
-Tests can be grouped together into random groups using parenthesis
+Tests can be grouped together into random groups using tqparenthesis
(e.g: "(0123)") or square brackets ("[012][3456789]"). Such grouping is
only relevant to the Random DFS scan (see below).
@@ -332,7 +332,7 @@ used in all the normal scans.
--reparent-states
This option specifies that states that were encountered whose depth in the
-states graph can be improved should be reparented to the new parent. This
+states graph can be improved should be reparented to the new tqparent. This
option can possibly make solutions shorter.
@@ -502,7 +502,7 @@ If you are working on a UNIX or a similar system then you can set some
run-time options in "fc-solve" by sending it some signal
combinations.
-If you send the signal USR1, without sending any other signals before
+If you send the signal USR1, without sending any other Q_SIGNALS before
that, then "fc-solve" will output the present number of
iterations. This method is a good way to monitor an instance that takes
a long time to solve.
@@ -512,7 +512,7 @@ will print the iteration number and depth on every state that it
checks. It is the equivalent of specifying (or unspecifying) the
option -i/--iter-output.
-If you send it two USR2 signals and then USR1, then "fc-solve"
+If you send it two USR2 Q_SIGNALS and then USR1, then "fc-solve"
will also print the board of every state. Again, this will only be done
assuming the iteration output is turned on.
diff --git a/kpat/freecell-solver/caas.c b/kpat/freecell-solver/caas.c
index 82492f34..3654ab59 100644
--- a/kpat/freecell-solver/caas.c
+++ b/kpat/freecell-solver/caas.c
@@ -63,7 +63,7 @@
if (hash_value_int < 0) \
{ \
/* \
- * This is a bit mask that nullifies the sign bit of the \
+ * This is a bit tqmask that nullifies the sign bit of the \
* number so it will always be positive \
* */ \
hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1))); \
@@ -92,7 +92,7 @@
if (hash_value_int < 0) \
{ \
/* \
- * This is a bit mask that nullifies the sign bit of the \
+ * This is a bit tqmask that nullifies the sign bit of the \
* number so it will always be positive \
* */ \
hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1))); \
@@ -333,7 +333,7 @@ static GCC_INLINE void freecell_solver_cache_stacks(
if (hash_value_int < 0)
{
/*
- * This is a bit mask that nullifies the sign bit of the
+ * This is a bit tqmask that nullifies the sign bit of the
* number so it will always be positive
* */
hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1)));
@@ -372,7 +372,7 @@ static GCC_INLINE void freecell_solver_cache_stacks(
);
#if 0
) /* In order to settle gvim and other editors that
- are keen on parenthesis matching */
+ are keen on tqparenthesis matching */
#endif
replace_with_cached(cached_stack != NULL);
@@ -437,7 +437,7 @@ void freecell_solver_cache_talon(
if (hash_value_int < 0)
{
/*
- * This is a bit mask that nullifies the sign bit of the
+ * This is a bit tqmask that nullifies the sign bit of the
* number so it will always be positive
* */
hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1)));
@@ -529,9 +529,9 @@ GCC_INLINE int freecell_solver_check_and_add_state(
if (check)
{
/* The new state was not found in the cache, and it was already inserted */
- if (new_state->parent)
+ if (new_state->tqparent)
{
- new_state->parent->num_active_children++;
+ new_state->tqparent->num_active_tqchildren++;
}
instance->num_states_in_collection++;
diff --git a/kpat/freecell-solver/fcs.h b/kpat/freecell-solver/fcs.h
index 43300310..6bca557f 100644
--- a/kpat/freecell-solver/fcs.h
+++ b/kpat/freecell-solver/fcs.h
@@ -170,7 +170,7 @@ typedef struct freecell_solver_instance
* The debug_iter_output variables provide a programmer programmable way
* to debug the algorithm while it is running. This works well for DFS
* and Soft-DFS scans but at present support for A* and BFS is not
- * too good, as its hard to tell which state came from which parent state.
+ * too good, as its hard to tell which state came from which tqparent state.
*
* debug_iter_output is a flag that indicates whether to use this feature
* at all.
@@ -190,7 +190,7 @@ typedef struct freecell_solver_instance
int depth,
void * instance,
fcs_state_with_locations_t * state,
- int parent_iter_num
+ int tqparent_iter_num
);
void * debug_iter_output_context;
@@ -582,7 +582,7 @@ struct freecell_solver_soft_thread_struct
/*
* The priority queue of the A* scan */
- PQUEUE * a_star_pqueue;
+ PTQUEUE * a_star_pqueue;
double a_star_initial_cards_under_sequences;
/*
@@ -683,7 +683,7 @@ typedef struct freecell_solver_soft_thread_struct freecell_solver_soft_thread_t;
#define FCS_A_STAR_WEIGHT_CARDS_OUT 0
#define FCS_A_STAR_WEIGHT_MAX_SEQUENCE_MOVE 1
#define FCS_A_STAR_WEIGHT_CARDS_UNDER_SEQUENCES 2
-#define FCS_A_STAR_WEIGHT_SEQS_OVER_RENEGADE_CARDS 3
+#define FCS_A_STAR_WEIGHT_SETQS_OVER_RENEGADE_CARDS 3
#define FCS_A_STAR_WEIGHT_DEPTH 4
freecell_solver_instance_t * freecell_solver_alloc_instance(void);
diff --git a/kpat/freecell-solver/fcs_hash.c b/kpat/freecell-solver/fcs_hash.c
index fde7a03f..2ae2d60b 100644
--- a/kpat/freecell-solver/fcs_hash.c
+++ b/kpat/freecell-solver/fcs_hash.c
@@ -53,7 +53,7 @@ SFO_hash_t * freecell_solver_hash_init(
hash = (SFO_hash_t *)malloc(sizeof(SFO_hash_t));
hash->size = size;
- hash->size_bitmask = size-1;
+ hash->size_bittqmask = size-1;
hash->num_elems = 0;
@@ -87,7 +87,7 @@ void * freecell_solver_hash_insert(
SFO_hash_symlink_item_t * item, * last_item;
/* Get the index of the appropriate chain in the hash table */
- place = hash_value & (hash->size_bitmask);
+ place = hash_value & (hash->size_bittqmask);
list = &(hash->entries[place]);
/* If first_item is non-existent */
@@ -220,7 +220,7 @@ static void SFO_hash_rehash(
SFO_hash_t * hash
)
{
- int old_size, new_size, new_size_bitmask;
+ int old_size, new_size, new_size_bittqmask;
int i;
#if 0
SFO_hash_t * new_hash;
@@ -242,7 +242,7 @@ static void SFO_hash_rehash(
old_size = hash->size;
new_size = old_size << 1;
- new_size_bitmask = new_size - 1;
+ new_size_bittqmask = new_size - 1;
new_entries = calloc(new_size, sizeof(SFO_hash_symlink_t));
@@ -254,7 +254,7 @@ static void SFO_hash_rehash(
while(item != NULL)
{
/* The place in the new hash table */
- place = item->hash_value & new_size_bitmask;
+ place = item->hash_value & new_size_bittqmask;
/* Store the next item in the linked list in a safe place,
so we can retrieve it after the assignment */
@@ -280,7 +280,7 @@ static void SFO_hash_rehash(
#endif
hash->entries = new_entries;
hash->size = new_size;
- hash->size_bitmask = new_size_bitmask;
+ hash->size_bittqmask = new_size_bittqmask;
}
#else
diff --git a/kpat/freecell-solver/fcs_hash.h b/kpat/freecell-solver/fcs_hash.h
index fbe6c78c..77d746f0 100644
--- a/kpat/freecell-solver/fcs_hash.h
+++ b/kpat/freecell-solver/fcs_hash.h
@@ -53,8 +53,8 @@ struct SFO_hash_struct
/* The size of the hash table */
int size;
- /* A bit mask that extract the lowest bits out of the hash value */
- int size_bitmask;
+ /* A bit tqmask that extract the lowest bits out of the hash value */
+ int size_bittqmask;
/* The number of elements stored inside the hash */
int num_elems;
/* A context to pass to the comparison function */
diff --git a/kpat/freecell-solver/fcs_user.h b/kpat/freecell-solver/fcs_user.h
index 8ddbf6f2..0d9fe815 100644
--- a/kpat/freecell-solver/fcs_user.h
+++ b/kpat/freecell-solver/fcs_user.h
@@ -165,7 +165,7 @@ typedef void (*freecell_solver_user_iter_handler_t)
int iter_num,
int depth,
void * ptr_state,
- int parent_iter_num,
+ int tqparent_iter_num,
void * context
);
diff --git a/kpat/freecell-solver/freecell.c b/kpat/freecell-solver/freecell.c
index 159772ff..fca09078 100644
--- a/kpat/freecell-solver/freecell.c
+++ b/kpat/freecell-solver/freecell.c
@@ -243,7 +243,7 @@ int freecell_solver_sfs_move_freecell_cards_on_top_of_stacks(
{
src_card = fcs_freecell_card(state, fc);
- /* If the freecell is not empty and dest_card is its parent
+ /* If the freecell is not empty and dest_card is its tqparent
* */
if ( (fcs_card_card_num(src_card) != 0) &&
fcs_is_parent_card(src_card,dest_card) )
@@ -533,7 +533,7 @@ int freecell_solver_sfs_move_stack_cards_to_a_parent_on_the_same_stack(
sequences_are_built_by = instance->sequences_are_built_by;
/*
- * Now let's try to move a stack card to a parent card which is found
+ * Now let's try to move a stack card to a tqparent card which is found
* on the same stack.
* */
for (stack=0;stack<state_stacks_num;stack++)
@@ -547,7 +547,7 @@ int freecell_solver_sfs_move_stack_cards_to_a_parent_on_the_same_stack(
card = fcs_stack_card(state, stack, c);
- /* Do not move cards that are already found above a suitable parent */
+ /* Do not move cards that are already found above a suitable tqparent */
a = 1;
if (c != 0)
{
@@ -1368,7 +1368,7 @@ int freecell_solver_sfs_move_cards_to_a_different_parent(
fcs_move_init(temp_move);
- /* This time try to move cards that are already on top of a parent to a different parent */
+ /* This time try to move cards that are already on top of a tqparent to a different tqparent */
for (stack=0;stack<state_stacks_num;stack++)
{
@@ -1398,7 +1398,7 @@ int freecell_solver_sfs_move_cards_to_a_different_parent(
card = fcs_stack_card(state, stack, c);
- /* Do not move cards that are already found above a suitable parent */
+ /* Do not move cards that are already found above a suitable tqparent */
a = 1;
if (c != 0)
{
@@ -1697,7 +1697,7 @@ int freecell_solver_sfs_yukon_move_card_to_parent(
if (fcs_is_parent_card(card, dest_card))
{
/* We can move it there - now let's check to see
- * if it is already above a suitable parent. */
+ * if it is already above a suitable tqparent. */
if ((c == 0) ||
(! fcs_is_parent_card(card, fcs_stack_card(state, stack, c-1))))
{
diff --git a/kpat/freecell-solver/intrface.c b/kpat/freecell-solver/intrface.c
index 6551652b..e70e8fca 100644
--- a/kpat/freecell-solver/intrface.c
+++ b/kpat/freecell-solver/intrface.c
@@ -214,7 +214,7 @@ static freecell_solver_soft_thread_t * alloc_soft_thread(
freecell_solver_initialize_bfs_queue(soft_thread);
/* Initialize the priotity queue of the A* scan */
- soft_thread->a_star_pqueue = malloc(sizeof(PQUEUE));
+ soft_thread->a_star_pqueue = malloc(sizeof(PTQUEUE));
freecell_solver_PQueueInitialise(
soft_thread->a_star_pqueue,
1024
@@ -795,8 +795,8 @@ static void trace_solution(
s1 = instance->final_state;
- /* Retrace the step from the current state to its parents */
- while (s1->parent != NULL)
+ /* Retrace the step from the current state to its tqparents */
+ while (s1->tqparent != NULL)
{
/* Mark the state as part of the non-optimized solution */
s1->visited |= FCS_VISITED_IN_SOLUTION_PATH;
@@ -811,8 +811,8 @@ static void trace_solution(
}
/* Duplicate the state to a freshly malloced memory */
- /* Move to the parent state */
- s1 = s1->parent;
+ /* Move to the tqparent state */
+ s1 = s1->tqparent;
}
/* There's one more state than there are move stacks */
s1->visited |= FCS_VISITED_IN_SOLUTION_PATH;
@@ -915,7 +915,7 @@ int freecell_solver_solve_instance(
state_copy_ptr->depth = 0;
state_copy_ptr->moves_to_parent = NULL;
state_copy_ptr->visited = 0;
- state_copy_ptr->parent = NULL;
+ state_copy_ptr->tqparent = NULL;
memset(&(state_copy_ptr->scan_visited), '\0', sizeof(state_copy_ptr->scan_visited));
instance->state_copy_ptr = state_copy_ptr;
diff --git a/kpat/freecell-solver/lib.c b/kpat/freecell-solver/lib.c
index 1839614b..e887fe00 100644
--- a/kpat/freecell-solver/lib.c
+++ b/kpat/freecell-solver/lib.c
@@ -892,7 +892,7 @@ static void freecell_solver_user_iter_handler_wrapper(
int depth,
void * lp_instance,
fcs_state_with_locations_t * ptr_state_with_locations,
- int parent_iter_num
+ int tqparent_iter_num
)
{
fcs_user_t * user;
@@ -904,7 +904,7 @@ static void freecell_solver_user_iter_handler_wrapper(
iter_num,
depth,
(void *)ptr_state_with_locations,
- parent_iter_num,
+ tqparent_iter_num,
user->iter_handler_context
);
diff --git a/kpat/freecell-solver/lookup2.c b/kpat/freecell-solver/lookup2.c
index 6ab9ae7e..c5886304 100644
--- a/kpat/freecell-solver/lookup2.c
+++ b/kpat/freecell-solver/lookup2.c
@@ -19,7 +19,7 @@ Note:
#define hashsize(n) ((ub4)1<<(n))
-#define hashmask(n) (hashsize(n)-1)
+#define hashtqmask(n) (hashsize(n)-1)
/*
--------------------------------------------------------------------
diff --git a/kpat/freecell-solver/main.c b/kpat/freecell-solver/main.c
index d16468c4..f4949741 100644
--- a/kpat/freecell-solver/main.c
+++ b/kpat/freecell-solver/main.c
@@ -43,7 +43,7 @@ static void my_iter_handler(
int iter_num,
int depth,
void * ptr_state,
- int parent_iter_num,
+ int tqparent_iter_num,
void * lp_context
)
{
@@ -57,7 +57,7 @@ static void my_iter_handler(
);
if (context->display_parent_iter_num)
{
- fprintf(stdout, "Parent Iteration: %i\n", parent_iter_num);
+ fprintf(stdout, "Parent Iteration: %i\n", tqparent_iter_num);
}
fprintf(stdout, "\n");
@@ -169,8 +169,8 @@ help_screen_t help_screens[] = {
"-snx --standard-notation-extended\n"
" Display the moves in extended standard notation while specifying the\n"
" number of cards moved if applicable\n"
-"-pi --display-parent-iter \n"
-" Display the index of the parent iteration of each state in the\n"
+"-pi --display-tqparent-iter \n"
+" Display the index of the tqparent iteration of each state in the\n"
" run-time dump.\n"
"\n"
"--freecells-num [Freecells\' Number]\n"
@@ -227,35 +227,35 @@ help_screen_t help_screens[] = {
" '2' - put freecell cards on top of stacks.\n"
" '3' - put non-top stack cards in the foundations.\n"
" '4' - move stack cards to different stacks.\n"
-" '5' - move stack cards to a parent card on the same stack.\n"
+" '5' - move stack cards to a tqparent card on the same stack.\n"
" '6' - move sequences of cards onto free stacks.\n"
" '7' - put freecell cards on empty stacks.\n"
-" '8' - move cards to a different parent.\n"
+" '8' - move cards to a different tqparent.\n"
" '9' - empty an entire stack into the freecells.\n"
"\n"
" Atomic Freecell Tests:\n"
"\n"
" 'A' - move a stack card to an empty stack.\n"
-" 'B' - move a stack card to a parent on a different stack.\n"
+" 'B' - move a stack card to a tqparent on a different stack.\n"
" 'C' - move a stack card to a freecell.\n"
-" 'D' - move a freecel card to a parent.\n"
+" 'D' - move a freecel card to a tqparent.\n"
" 'E' - move a freecel card to an empty stack.\n"
"\n"
" Simple Simon Tests:\n"
"\n"
" 'a' - move a full sequence to the foundations.\n"
-" 'b' - move a sequence to a true parent of his.\n"
-" 'c' - move a whole stack sequence to a false parent (in order to\n"
+" 'b' - move a sequence to a true tqparent of his.\n"
+" 'c' - move a whole stack sequence to a false tqparent (in order to\n"
" clear the stack)\n"
-" 'd' - move a sequence to a true parent that has some cards above it.\n"
-" 'e' - move a sequence with some cards above it to a true parent.\n"
-" 'f' - move a sequence with a junk sequence above it to a true parent\n"
+" 'd' - move a sequence to a true tqparent that has some cards above it.\n"
+" 'e' - move a sequence with some cards above it to a true tqparent.\n"
+" 'f' - move a sequence with a junk sequence above it to a true tqparent\n"
" that has some cards above it.\n"
-" 'g' - move a whole stack sequence to a false parent which has some\n"
+" 'g' - move a whole stack sequence to a false tqparent which has some\n"
" cards above it.\n"
-" 'h' - move a sequence to a parent on the same stack.\n"
+" 'h' - move a sequence to a tqparent on the same stack.\n"
"\n"
-" Tests are grouped with parenthesis or square brackets. Each group\n"
+" Tests are grouped with tqparenthesis or square brackets. Each group\n"
" will be randomized as a whole by the random-dfs scan.\n"
"\n"
"\n"
@@ -313,7 +313,7 @@ help_screen_t help_screens[] = {
"\n"
"\n"
"--reparent-states\n"
-" Reparent states that have a larger depth than that of the state\n"
+" Retqparent states that have a larger depth than that of the state\n"
" from which they were reached a posteriori.\n"
"--calc-real-depth\n"
" If --reparent-states is enabled, then explictly calculate the real\n"
@@ -498,7 +498,7 @@ static int cmd_line_callback(
dc->display_moves = 1;
dc->display_states = 1;
}
- else if ((!strcmp(argv[arg], "-pi")) || (!strcmp(argv[arg], "--display-parent-iter")))
+ else if ((!strcmp(argv[arg], "-pi")) || (!strcmp(argv[arg], "--display-tqparent-iter")))
{
dc->display_parent_iter_num = 1;
}
@@ -588,7 +588,7 @@ static char * known_parameters[] = {
"-sn", "--standard-notation",
"-snx", "--standard-notation-extended",
"-sam", "--display-states-and-moves",
- "-pi", "--display-parent-iter",
+ "-pi", "--display-tqparent-iter",
"--reset",
NULL
};
@@ -658,12 +658,12 @@ int main(int argc, char * argv[])
if ((arg == argc) || (!strcmp(argv[arg], "-")))
{
file = stdin;
- if (!getenv("FREECELL_SOLVER_QUIET"))
+ if (!getenv("FREECELL_SOLVER_TQUIET"))
{
fprintf(stderr, "%s",
"Reading the board from the standard input.\n"
"Type \"fc-solve --help\" for more usage information.\n"
- "To cancel this message set the FREECELL_SOLVER_QUIET environment variable.\n"
+ "To cancel this message set the FREECELL_SOLVER_TQUIET environment variable.\n"
);
}
}
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])) )
diff --git a/kpat/freecell-solver/pqueue.h b/kpat/freecell-solver/pqueue.h
index cf5f5372..d4cfd7a3 100644
--- a/kpat/freecell-solver/pqueue.h
+++ b/kpat/freecell-solver/pqueue.h
@@ -11,8 +11,8 @@
http://www.geocities.com/jheyesjones/astar.html
*/
-#ifndef FC_SOLVE__PQUEUE_H
-#define FC_SOLVE__PQUEUE_H
+#ifndef FC_SOLVE__PTQUEUE_H
+#define FC_SOLVE__PTQUEUE_H
#ifdef __cplusplus
extern "C" {
@@ -22,7 +22,7 @@ extern "C" {
#include "jhjtypes.h"
-#define PQUEUE_MaxRating INT_MAX
+#define PTQUEUE_MaxRating INT_MAX
typedef int32 pq_rating_t;
@@ -32,35 +32,35 @@ typedef struct struct_pq_element_t
pq_rating_t rating;
} pq_element_t;
-typedef struct _PQUEUE
+typedef struct _PTQUEUE
{
int32 MaxSize;
int32 CurrentSize;
pq_element_t * Elements; /* pointer to void pointers */
pq_rating_t MaxRating; /* biggest element possible */
-} PQUEUE;
+} PTQUEUE;
/* 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 */
-/* the parent is always given by index/2 */
-#define PQ_PARENT_INDEX(i) ((i)>>1)
-#define PQ_FIRST_ENTRY (1)
+/* the tqparent is always given by index/2 */
+#define PTQ_PARENT_INDEX(i) ((i)>>1)
+#define PTQ_FIRST_ENTRY (1)
-/* left and right children are index * 2 and (index * 2) +1 respectively */
-#define PQ_LEFT_CHILD_INDEX(i) ((i)<<1)
-#define PQ_RIGHT_CHILD_INDEX(i) (((i)<<1)+1)
+/* left and right tqchildren are index * 2 and (index * 2) +1 respectively */
+#define PTQ_LEFT_CHILD_INDEX(i) ((i)<<1)
+#define PTQ_RIGHT_CHILD_INDEX(i) (((i)<<1)+1)
void freecell_solver_PQueueInitialise(
- PQUEUE *pq,
+ PTQUEUE *pq,
int32 MaxElements
);
-void freecell_solver_PQueueFree( PQUEUE *pq );
+void freecell_solver_PQueueFree( PTQUEUE *pq );
-int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t);
+int freecell_solver_PQueuePush( PTQUEUE *pq, void *item, pq_rating_t);
-void *freecell_solver_PQueuePop( PQUEUE *pq);
+void *freecell_solver_PQueuePop( PTQUEUE *pq);
#define PGetRating(elem) ((elem).rating)
@@ -68,4 +68,4 @@ void *freecell_solver_PQueuePop( PQUEUE *pq);
}
#endif
-#endif /* #ifdef FC_SOLVE__PQUEUE_H */
+#endif /* #ifdef FC_SOLVE__PTQUEUE_H */
diff --git a/kpat/freecell-solver/preset.c b/kpat/freecell-solver/preset.c
index 16a02f1d..9286fd83 100644
--- a/kpat/freecell-solver/preset.c
+++ b/kpat/freecell-solver/preset.c
@@ -457,7 +457,7 @@ int freecell_solver_apply_tests_order(
}
if (! is_group)
{
- *error_string = strdup("There's a renegade right parenthesis or bracket.");
+ *error_string = strdup("There's a renegade right tqparenthesis or bracket.");
return 3;
}
is_group = 0;
diff --git a/kpat/freecell-solver/scans.c b/kpat/freecell-solver/scans.c
index 5c579739..31a5dd18 100644
--- a/kpat/freecell-solver/scans.c
+++ b/kpat/freecell-solver/scans.c
@@ -406,7 +406,7 @@ int freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume(
freecell_solver_increase_dfs_max_depth(soft_thread);
/* Initialize the initial state to indicate it is the first */
- ptr_state_with_locations_orig->parent = NULL;
+ ptr_state_with_locations_orig->tqparent = NULL;
ptr_state_with_locations_orig->moves_to_parent = NULL;
ptr_state_with_locations_orig->depth = 0;
@@ -692,7 +692,7 @@ int freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume(
ptr_recurse_into_state_with_locations->visited_iter = instance->num_times;
#if 0
- ptr_recurse_into_state_with_locations->parent = ptr_state_with_locations;
+ ptr_recurse_into_state_with_locations->tqparent = ptr_state_with_locations;
#endif
/*
@@ -727,7 +727,7 @@ int freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume(
#undef myreturn
#define FCS_A_STAR_CARDS_UNDER_SEQUENCES_EXPONENT 1.3
-#define FCS_A_STAR_SEQS_OVER_RENEGADE_CARDS_EXPONENT 1.3
+#define FCS_A_STAR_SETQS_OVER_RENEGADE_CARDS_EXPONENT 1.3
#define state (ptr_state_with_locations->s)
@@ -827,7 +827,7 @@ static pq_rating_t freecell_solver_a_star_rate_state(
seqs_over_renegade_cards +=
((unlimited_sequence_move) ?
1 :
- pow(cards_num-c-1, FCS_A_STAR_SEQS_OVER_RENEGADE_CARDS_EXPONENT)
+ pow(cards_num-c-1, FCS_A_STAR_SETQS_OVER_RENEGADE_CARDS_EXPONENT)
);
}
}
@@ -836,8 +836,8 @@ static pq_rating_t freecell_solver_a_star_rate_state(
/ soft_thread->a_star_initial_cards_under_sequences) * a_star_weights[FCS_A_STAR_WEIGHT_CARDS_UNDER_SEQUENCES];
ret += (seqs_over_renegade_cards /
- pow(decks_num*52, FCS_A_STAR_SEQS_OVER_RENEGADE_CARDS_EXPONENT) )
- * a_star_weights[FCS_A_STAR_WEIGHT_SEQS_OVER_RENEGADE_CARDS];
+ pow(decks_num*52, FCS_A_STAR_SETQS_OVER_RENEGADE_CARDS_EXPONENT) )
+ * a_star_weights[FCS_A_STAR_WEIGHT_SETQS_OVER_RENEGADE_CARDS];
num_cards_in_founds = 0;
for(a=0;a<(decks_num<<2);a++)
@@ -945,7 +945,7 @@ int freecell_solver_a_star_or_bfs_do_solve_or_resume(
);
int scans_synergy = instance->scans_synergy;
fcs_states_linked_list_item_t * bfs_queue = soft_thread->bfs_queue;
- PQUEUE * a_star_pqueue = soft_thread->a_star_pqueue;
+ PTQUEUE * a_star_pqueue = soft_thread->a_star_pqueue;
fcs_states_linked_list_item_t * bfs_queue_last_item = soft_thread->bfs_queue_last_item;
derived.num_states = 0;
@@ -958,7 +958,7 @@ int freecell_solver_a_star_or_bfs_do_solve_or_resume(
if (!resume)
{
/* Initialize the first element to indicate it is the first */
- ptr_state_with_locations_orig->parent = NULL;
+ ptr_state_with_locations_orig->tqparent = NULL;
ptr_state_with_locations_orig->moves_to_parent = NULL;
ptr_state_with_locations_orig->depth = 0;
}
@@ -1027,9 +1027,9 @@ int freecell_solver_a_star_or_bfs_do_solve_or_resume(
ptr_state_with_locations->depth,
(void*)instance,
ptr_state_with_locations,
- ((ptr_state_with_locations->parent == NULL) ?
+ ((ptr_state_with_locations->tqparent == NULL) ?
0 :
- ptr_state_with_locations->parent->visited_iter
+ ptr_state_with_locations->tqparent->visited_iter
)
);
}
diff --git a/kpat/freecell-solver/simpsim.c b/kpat/freecell-solver/simpsim.c
index f603ba39..a51b0c50 100644
--- a/kpat/freecell-solver/simpsim.c
+++ b/kpat/freecell-solver/simpsim.c
@@ -19,16 +19,16 @@
#endif
-#define fcs_is_ss_false_parent(parent, child) \
- (fcs_card_card_num(parent) == fcs_card_card_num(child)+1)
+#define fcs_is_ss_false_parent(tqparent, child) \
+ (fcs_card_card_num(tqparent) == fcs_card_card_num(child)+1)
-#define fcs_suit_is_ss_true_parent(parent_suit, child_suit) \
- ((parent_suit) == (child_suit))
+#define fcs_suit_is_ss_true_parent(tqparent_suit, child_suit) \
+ ((tqparent_suit) == (child_suit))
-#define fcs_is_ss_true_parent(parent, child) \
+#define fcs_is_ss_true_parent(tqparent, child) \
( \
- fcs_is_ss_false_parent(parent,child) && \
- (fcs_suit_is_ss_true_parent(fcs_card_suit(parent),fcs_card_suit(child))) \
+ fcs_is_ss_false_parent(tqparent,child) && \
+ (fcs_suit_is_ss_true_parent(fcs_card_suit(tqparent),fcs_card_suit(child))) \
)
/*
@@ -185,7 +185,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent(
if (cards_num > 0)
{
/* Loop on the cards in the stack and try to look for a true
- * parent on top one of the stacks */
+ * tqparent on top one of the stacks */
card = fcs_stack_card(state,stack,cards_num-1);
card_num = fcs_card_card_num(card);
suit = fcs_card_suit(card);
@@ -208,7 +208,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent(
(fcs_card_card_num(dest_card) == (card_num+1))
)
{
- /* This is a suitable parent - let's check if we
+ /* This is a suitable tqparent - let's check if we
* have enough empty stacks to make the move feasible */
if (calc_max_sequence_move(0, num_freestacks) >= num_true_seqs)
{
@@ -334,7 +334,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent(
(fcs_is_ss_false_parent(dest_card, card))
)
{
- /* This is a suitable parent - let's check if we
+ /* This is a suitable tqparent - let's check if we
* have enough empty stacks to make the move feasible */
if (calc_max_sequence_move(0, num_freestacks) >= num_true_seqs)
{
@@ -387,7 +387,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_card
* dest_cards_num - the number of cards in "ds"
* dc - the index of the current card in "ds".
* num_separate_false_seqs - this variable tells how many distinct false
- * sequences exist above the true parent
+ * sequences exist above the true tqparent
* above_num_true_seqs[] - the number of true sequences in each false
* sequence
* seq_points[] - the separation points of the false sequences (i.e: where
@@ -451,7 +451,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_card
(fcs_card_card_num(dest_card) == (card_num+1))
)
{
- /* This is a suitable parent - let's check if there's a sequence above it. */
+ /* This is a suitable tqparent - let's check if there's a sequence above it. */
/*
* above_c - the height of the card that is to be checked.
@@ -504,7 +504,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_card
int clear_junk_dest_stack = -1;
- /* Let's try to find a suitable parent on top one of the stacks */
+ /* Let's try to find a suitable tqparent on top one of the stacks */
for(clear_junk_dest_stack=0;
clear_junk_dest_stack < state_stacks_num;
clear_junk_dest_stack++
@@ -573,7 +573,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_card
/*
* We can do it - so let's move everything.
* Notice that we only put the child in a different stack
- * then the parent and let it move to the parent in the
+ * then the tqparent and let it move to the tqparent in the
* next iteration of the program
* */
@@ -743,7 +743,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_with_some_cards_above_to_true
(fcs_card_card_num(dest_card) == (card_num+1))
)
{
- /* This is a suitable parent - let's check if we
+ /* This is a suitable tqparent - let's check if we
* have enough empty stacks to make the move feasible */
for(a=0;a<state_stacks_num;a++)
@@ -761,7 +761,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_with_some_cards_above_to_true
int clear_junk_dest_stack = -1;
- /* Let's try to find a suitable parent on top one of the stacks */
+ /* Let's try to find a suitable tqparent on top one of the stacks */
for(clear_junk_dest_stack=0;
clear_junk_dest_stack < state_stacks_num;
clear_junk_dest_stack++
@@ -1013,7 +1013,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_with_junk_seq_above_to_true_p
(fcs_card_card_num(dest_card) == (card_num+1))
)
{
- /* This is a suitable parent - let's check if there's a sequence above it. */
+ /* This is a suitable tqparent - let's check if there's a sequence above it. */
int above_c;
fcs_card_t above_card, up_above_card;
@@ -1068,7 +1068,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_with_junk_seq_above_to_true_p
above_num_true_seqs[false_seq_index]
);
- /* Let's try to find a suitable parent on top one of the stacks */
+ /* Let's try to find a suitable tqparent on top one of the stacks */
for(clear_junk_dest_stack=0;
clear_junk_dest_stack < state_stacks_num;
clear_junk_dest_stack++
@@ -1218,7 +1218,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_w
* dest_cards_num - the number of cards in it.
* dc - the height of the card in "ds".
* num_separate_false_seqs - this variable tells how many distinct false
- * sequences exist above the false parent
+ * sequences exist above the false tqparent
* above_num_true_seqs[] - the number of true sequences in each false
* sequence
* seq_points[] - the separation points of the false sequences (i.e: where
@@ -1291,7 +1291,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_w
(fcs_card_card_num(dest_card) == (card_num+1))
)
{
- /* This is a suitable parent - let's check if there's a sequence above it. */
+ /* This is a suitable tqparent - let's check if there's a sequence above it. */
int above_c;
fcs_card_t above_card, up_above_card;
@@ -1341,7 +1341,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_w
above_num_true_seqs[false_seq_index];
- /* Let's try to find a suitable parent on top one of the stacks */
+ /* Let's try to find a suitable tqparent on top one of the stacks */
for(clear_junk_dest_stack=0;
clear_junk_dest_stack < state_stacks_num;
clear_junk_dest_stack++
@@ -1380,7 +1380,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_w
if (false_seq_index == num_separate_false_seqs)
{
- /* This is a suitable parent - let's check if we
+ /* This is a suitable tqparent - let's check if we
* have enough empty stacks to make the move feasible */
if (calc_max_sequence_move(0, num_freestacks) >= num_true_seqs)
{
@@ -1450,7 +1450,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack(
int check;
int stack, cards_num, pc, cc;
- fcs_card_t parent_card, child_card;
+ fcs_card_t tqparent_card, child_card;
int a;
int after_junk_num_freestacks;
int false_seq_index;
@@ -1468,13 +1468,13 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack(
cards_num = fcs_stack_len(state, stack);
if (cards_num > 2)
{
- /* Search for a parent card */
+ /* Search for a tqparent card */
for(pc=0; pc < cards_num-1 ; pc++)
{
- parent_card = fcs_stack_card(state, stack, pc);
+ tqparent_card = fcs_stack_card(state, stack, pc);
if (
fcs_is_ss_true_parent(
- parent_card,
+ tqparent_card,
fcs_stack_card(state, stack, pc+1)
)
)
@@ -1487,12 +1487,12 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack(
{
child_card = fcs_stack_card(state, stack, cc);
if (fcs_is_ss_true_parent(
- parent_card,
+ tqparent_card,
child_card
)
)
{
- /* We have a matching parent and child cards */
+ /* We have a matching tqparent and child cards */
#if 0
printf("Stack %i, Parent %i, Child %i\n", stack, pc, cc);
fflush(stdout);
@@ -1559,7 +1559,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack(
above_num_true_seqs[num_separate_false_seqs] = child_num_true_seqs;
seq_points[num_separate_false_seqs++] = cc;
- /* Add the cards between the parent and the child to the seq_points */
+ /* Add the cards between the tqparent and the child to the seq_points */
above_card = fcs_stack_card(state, stack, cc-1);
above_num_true_seqs[num_separate_false_seqs] = 1;
@@ -1599,7 +1599,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack(
int clear_junk_dest_stack = -1;
- /* Let's try to find a suitable parent on top one of the stacks */
+ /* Let's try to find a suitable tqparent on top one of the stacks */
for(clear_junk_dest_stack=0;
clear_junk_dest_stack < state_stacks_num;
clear_junk_dest_stack++
diff --git a/kpat/freecell-solver/state.h b/kpat/freecell-solver/state.h
index e52b717c..7b312b42 100644
--- a/kpat/freecell-solver/state.h
+++ b/kpat/freecell-solver/state.h
@@ -72,12 +72,12 @@ struct fcs_struct_state_with_locations_t
fcs_state_t s;
int stack_locs[MAX_NUM_STACKS];
int fc_locs[MAX_NUM_FREECELLS];
- struct fcs_struct_state_with_locations_t * parent;
+ struct fcs_struct_state_with_locations_t * tqparent;
fcs_move_stack_t * moves_to_parent;
int depth;
int visited;
int visited_iter;
- int num_active_children;
+ int num_active_tqchildren;
int scan_visited[MAX_NUM_SCANS_BUCKETS];
};
@@ -232,12 +232,12 @@ struct fcs_struct_state_with_locations_t
fcs_state_t s;
char stack_locs[MAX_NUM_STACKS];
char fc_locs[MAX_NUM_FREECELLS];
- struct fcs_struct_state_with_locations_t * parent;
+ struct fcs_struct_state_with_locations_t * tqparent;
fcs_move_stack_t * moves_to_parent;
int depth;
int visited;
int visited_iter;
- int num_active_children;
+ int num_active_tqchildren;
int scan_visited[MAX_NUM_SCANS_BUCKETS];
};
@@ -484,7 +484,7 @@ struct fcs_struct_state_with_locations_t
fcs_state_t s;
fcs_locs_t stack_locs[MAX_NUM_STACKS];
fcs_locs_t fc_locs[MAX_NUM_FREECELLS];
- struct fcs_struct_state_with_locations_t * parent;
+ struct fcs_struct_state_with_locations_t * tqparent;
fcs_move_stack_t * moves_to_parent;
int depth;
/*
@@ -508,11 +508,11 @@ struct fcs_struct_state_with_locations_t
* */
int visited_iter;
/*
- * This is the number of direct children of this state which were not
+ * This is the number of direct tqchildren of this state which were not
* yet declared as dead ends. Once this counter reaches zero, this
* state too is declared as a dead end.
* */
- int num_active_children;
+ int num_active_tqchildren;
/*
* This is a vector of flags - one for each scan. Each indicates whether
* its scan has already visited this state
diff --git a/kpat/freecell-solver/test_arr.h b/kpat/freecell-solver/test_arr.h
index cfc5cd12..821ccd98 100644
--- a/kpat/freecell-solver/test_arr.h
+++ b/kpat/freecell-solver/test_arr.h
@@ -26,19 +26,19 @@ typedef int (*freecell_solver_solve_for_state_test_t)(
extern freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TESTS_NUM];
/*
- * This macro determines if child can be placed above parent.
+ * This macro determines if child can be placed above tqparent.
*
* The variable sequences_are_built_by has to be initialized to
* the sequences_are_built_by member of the instance.
*
* */
-#define fcs_is_parent_card(child, parent) \
- ((fcs_card_card_num(child)+1 == fcs_card_card_num(parent)) && \
+#define fcs_is_parent_card(child, tqparent) \
+ ((fcs_card_card_num(child)+1 == fcs_card_card_num(tqparent)) && \
((sequences_are_built_by == FCS_SEQ_BUILT_BY_RANK) ? \
1 : \
((sequences_are_built_by == FCS_SEQ_BUILT_BY_SUIT) ? \
- (fcs_card_suit(child) == fcs_card_suit(parent)) : \
- ((fcs_card_suit(child) & 0x1) != (fcs_card_suit(parent)&0x1)) \
+ (fcs_card_suit(child) == fcs_card_suit(tqparent)) : \
+ ((fcs_card_suit(child) & 0x1) != (fcs_card_suit(tqparent)&0x1)) \
)) \
)
@@ -58,7 +58,7 @@ extern freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TEST
/* Count the number of states until the original state. */ \
while(ptr_state != NULL) \
{ \
- ptr_state = ptr_state->parent; \
+ ptr_state = ptr_state->tqparent; \
this_real_depth++; \
} \
this_real_depth--; \
@@ -68,14 +68,14 @@ extern freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TEST
{ \
ptr_state->depth = this_real_depth; \
this_real_depth--; \
- ptr_state = ptr_state->parent; \
+ ptr_state = ptr_state->tqparent; \
} \
} \
} \
/*
* This macro marks a state as a dead end, and afterwards propogates
- * this information to its parent and ancestor states.
+ * this information to its tqparent and ancestor states.
* */
#define mark_as_dead_end(ptr_state_input) \
{ \
@@ -84,23 +84,23 @@ extern freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TEST
fcs_state_with_locations_t * ptr_state = (ptr_state_input); \
/* Mark as a dead end */ \
ptr_state->visited |= FCS_VISITED_DEAD_END; \
- ptr_state = ptr_state->parent; \
+ ptr_state = ptr_state->tqparent; \
if (ptr_state != NULL) \
{ \
/* Decrease the refcount of the state */ \
- ptr_state->num_active_children--; \
- while((ptr_state->num_active_children == 0) && (ptr_state->visited & FCS_VISITED_ALL_TESTS_DONE)) \
+ ptr_state->num_active_tqchildren--; \
+ while((ptr_state->num_active_tqchildren == 0) && (ptr_state->visited & FCS_VISITED_ALL_TESTS_DONE)) \
{ \
/* Mark as dead end */ \
ptr_state->visited |= FCS_VISITED_DEAD_END; \
- /* Go to its parent state */ \
- ptr_state = ptr_state->parent; \
+ /* Go to its tqparent state */ \
+ ptr_state = ptr_state->tqparent; \
if (ptr_state == NULL) \
{ \
break; \
} \
/* Decrease the refcount */ \
- ptr_state->num_active_children--; \
+ ptr_state->num_active_tqchildren--; \
} \
} \
} \
diff --git a/kpat/freecell-solver/tests.h b/kpat/freecell-solver/tests.h
index ce0b35b5..fbf78262 100644
--- a/kpat/freecell-solver/tests.h
+++ b/kpat/freecell-solver/tests.h
@@ -58,7 +58,7 @@ extern "C" {
/* Some A* and BFS parameters that need to be initialized in \
* the derived state. \
* */ \
- ptr_new_state_with_locations->parent = ptr_state_with_locations; \
+ ptr_new_state_with_locations->tqparent = ptr_state_with_locations; \
ptr_new_state_with_locations->moves_to_parent = moves; \
/* Make sure depth is consistent with the game graph. \
* I.e: the depth of every newly discovered state is derived from \
@@ -66,8 +66,8 @@ extern "C" {
ptr_new_state_with_locations->depth = ptr_state_with_locations->depth + 1; \
/* Mark this state as a state that was not yet visited */ \
ptr_new_state_with_locations->visited = 0; \
- /* It's a newly created state which does not have children yet. */ \
- ptr_new_state_with_locations->num_active_children = 0; \
+ /* It's a newly created state which does not have tqchildren yet. */ \
+ ptr_new_state_with_locations->num_active_tqchildren = 0; \
memset(ptr_new_state_with_locations->scan_visited, '\0', \
sizeof(ptr_new_state_with_locations->scan_visited) \
); \
@@ -103,11 +103,11 @@ fcs_move_stack_push(moves, temp_move); \
{ \
fcs_state_ia_release(hard_thread); \
calculate_real_depth(existing_state); \
- /* Re-parent the existing state to this one. \
+ /* Re-tqparent the existing state to this one. \
* \
* What it means is that if the depth of the state if it \
* can be reached from this one is lower than what it \
- * already have, then re-assign its parent to this state. \
+ * already have, then re-assign its tqparent to this state. \
* */ \
if (reparent && \
(existing_state->depth > ptr_state_with_locations->depth+1)) \
@@ -119,15 +119,15 @@ fcs_move_stack_push(moves, temp_move); \
); \
if (!(existing_state->visited & FCS_VISITED_DEAD_END)) \
{ \
- if ((--existing_state->parent->num_active_children) == 0) \
+ if ((--existing_state->tqparent->num_active_tqchildren) == 0) \
{ \
mark_as_dead_end( \
- existing_state->parent \
+ existing_state->tqparent \
); \
} \
- ptr_state_with_locations->num_active_children++; \
+ ptr_state_with_locations->num_active_tqchildren++; \
} \
- existing_state->parent = ptr_state_with_locations; \
+ existing_state->tqparent = ptr_state_with_locations; \
existing_state->depth = ptr_state_with_locations->depth + 1; \
} \
fcs_derived_states_list_add_state( \