Commits

Shlomi Fish committed 489997b

Converted away from freecell_solver_ to fc_solve_ which is shorter and saner.

freecell_solver_user_ still remains the same in order to not break API
compatiblity.

git-svn-id: file:///home/shlomif/Backup/svn-dumps/google-code/svnsync-repos/fc-solve/trunk@1174 e7e8a897-7ba4-4ee7-b36f-f4c66519b19a

  • Participants
  • Parent commits f905534

Comments (0)

Files changed (38)

File fc-solve/source/alloc.c

 #define ALLOCED_SIZE (8*1024-10*sizeof(char *))
 
 fcs_compact_allocator_t * 
-    freecell_solver_compact_allocator_new(void)
+    fc_solve_compact_allocator_new(void)
 {
     fcs_compact_allocator_t * allocator;
 
     return allocator;
 }
 
-void freecell_solver_compact_allocator_extend(
+void fc_solve_compact_allocator_extend(
     fcs_compact_allocator_t * allocator
         )
 {
 
 #if 0
 char * 
-    freecell_solver_compact_allocator_alloc(
+    fc_solve_compact_allocator_alloc(
         fcs_compact_allocator_t * allocator,
         int how_much
             )
 {
     if (allocator->max_ptr - allocator->ptr < how_much)
     {
-        freecell_solver_compact_allocator_extend(allocator);
+        fc_solve_compact_allocator_extend(allocator);
     }
     allocator->rollback_ptr = allocator->ptr;
     allocator->ptr += (how_much+(4-(how_much&0x3)));
     return allocator->rollback_ptr;
 }
 
-void freecell_solver_compact_allocator_release(fcs_compact_allocator_t * allocator)
+void fc_solve_compact_allocator_release(fcs_compact_allocator_t * allocator)
 {
     allocator->ptr = allocator->rollback_ptr;
 }
 #endif
 
-void freecell_solver_compact_allocator_finish(fcs_compact_allocator_t * allocator)
+void fc_solve_compact_allocator_finish(fcs_compact_allocator_t * allocator)
 {
     int a;
     for(a=0;a<allocator->num_packs;a++)
     free(allocator);
 }
 
-void freecell_solver_compact_allocator_foreach(
+void fc_solve_compact_allocator_foreach(
     fcs_compact_allocator_t * allocator,
     int data_width,
     void (*ptr_function)(void *, void *),

File fc-solve/source/alloc.h

 typedef struct fcs_compact_allocator_struct fcs_compact_allocator_t;
 
 extern fcs_compact_allocator_t * 
-    freecell_solver_compact_allocator_new(void);
+    fc_solve_compact_allocator_new(void);
 
-extern void freecell_solver_compact_allocator_extend(
+extern void fc_solve_compact_allocator_extend(
     fcs_compact_allocator_t * allocator
         );
 #if 0
 extern char * 
-    freecell_solver_compact_allocator_alloc(
+    fc_solve_compact_allocator_alloc(
         fcs_compact_allocator_t * allocator,
         int how_much
             );
    register fcs_compact_allocator_t * allocator = (allocator_orig); \
    if (allocator->max_ptr - allocator->ptr < sizeof(what_t))  \
     {      \
-        freecell_solver_compact_allocator_extend(allocator);      \
+        fc_solve_compact_allocator_extend(allocator);      \
     }         \
     allocator->rollback_ptr = allocator->ptr;       \
     allocator->ptr += ((sizeof(what_t))+(sizeof(char *)-((sizeof(what_t))&(sizeof(char *)-1))));      \
     register int how_much = (how_much_orig);     \
     if (allocator->max_ptr - allocator->ptr < how_much)  \
     {      \
-        freecell_solver_compact_allocator_extend(allocator);      \
+        fc_solve_compact_allocator_extend(allocator);      \
     }         \
     allocator->rollback_ptr = allocator->ptr;       \
     /* Round ptr to the next pointer boundary */      \
 #endif
 
 #if 0
-extern void freecell_solver_compact_allocator_release(fcs_compact_allocator_t * allocator);
+extern void fc_solve_compact_allocator_release(fcs_compact_allocator_t * allocator);
 #else
 #define fcs_compact_alloc_release(allocator) \
 {    \
 } 
 #endif
 
-extern void freecell_solver_compact_allocator_finish(fcs_compact_allocator_t * allocator);
+extern void fc_solve_compact_allocator_finish(fcs_compact_allocator_t * allocator);
     
-extern void freecell_solver_compact_allocator_foreach(
+extern void fc_solve_compact_allocator_foreach(
     fcs_compact_allocator_t * allocator,
     int data_width,
     void (*ptr_function)(void *, void *),

File fc-solve/source/app_str.c

 
 #define GROW_BY 4000
 
-struct freecell_solver_append_string_struct
+struct fc_solve_append_string_struct
 {
     char * buffer;
     char * end_of_buffer;
     int size_of_margin;
 };
 
-typedef struct freecell_solver_append_string_struct freecell_solver_append_string_t;
+typedef struct fc_solve_append_string_struct fc_solve_append_string_t;
 
-freecell_solver_append_string_t * freecell_solver_append_string_alloc(int size_margin)
+fc_solve_append_string_t * fc_solve_append_string_alloc(int size_margin)
 {
-    freecell_solver_append_string_t * app_str;
+    fc_solve_append_string_t * app_str;
 
     if (size_margin > GROW_BY)
     {
         return NULL;
     }
 
-    app_str = malloc(sizeof(freecell_solver_append_string_t));
+    app_str = malloc(sizeof(fc_solve_append_string_t));
     app_str->max_size = GROW_BY;
     app_str->end_of_buffer = app_str->buffer = malloc(app_str->max_size);
     app_str->size_of_margin = size_margin;
     return app_str;
 }
 
-int freecell_solver_append_string_sprintf(
-    freecell_solver_append_string_t * app_str,
+int fc_solve_append_string_sprintf(
+    fc_solve_append_string_t * app_str,
     char * format,
     ...
     )
     return num_chars_written;
 }
 
-char * freecell_solver_append_string_finalize(
-    freecell_solver_append_string_t * app_str
+char * fc_solve_append_string_finalize(
+    fc_solve_append_string_t * app_str
     )
 {
     char * ret;

File fc-solve/source/app_str.h

 extern "C" {
 #endif
 
-struct freecell_solver_append_string_struct
+struct fc_solve_append_string_struct
 {
     char * buffer;
     char * end_of_buffer;
     int size_of_margin;
 };
 
-typedef struct freecell_solver_append_string_struct freecell_solver_append_string_t;
+typedef struct fc_solve_append_string_struct fc_solve_append_string_t;
 
-extern freecell_solver_append_string_t * freecell_solver_append_string_alloc(int size_margin);
+extern fc_solve_append_string_t * fc_solve_append_string_alloc(int size_margin);
 
-extern int freecell_solver_append_string_sprintf(
-    freecell_solver_append_string_t * app_str,
+extern int fc_solve_append_string_sprintf(
+    fc_solve_append_string_t * app_str,
     char * format,
     ...
     );
 
-extern char * freecell_solver_append_string_finalize(
-    freecell_solver_append_string_t * app_str
+extern char * fc_solve_append_string_finalize(
+    fc_solve_append_string_t * app_str
     );
 
 #ifdef __cplusplus

File fc-solve/source/caas.c

 /*
  * caas.c - the various possible implementations of the function
- * freecell_solver_check_and_add_state().
+ * fc_solve_check_and_add_state().
  *
  * Written by Shlomi Fish ( http://www.shlomifish.org/ ), 2000
  *
          * */            \
         hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1)));     \
     }    \
-    check = ((*existing_state = freecell_solver_hash_insert(          \
+    check = ((*existing_state = fc_solve_hash_insert(          \
         instance->hash,              \
         new_state,                   \
         hash_value_int,              \
          * */                                                           \
         hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1)));      \
     }                                                                   \
-    check = ((*existing_state = freecell_solver_hash_insert(            \
+    check = ((*existing_state = fc_solve_hash_insert(            \
         instance->hash,                                                 \
         new_state,                                                      \
         freecell_solver_lookup2_hash_function(                          \
                 instance->indirect_prev_states,                     \
                 instance->num_indirect_prev_states,                 \
                 sizeof(fcs_state_with_locations_t *),               \
-                freecell_solver_state_compare_indirect)) == NULL)                \
+                fc_solve_state_compare_indirect)) == NULL)                \
     {                                                               \
         /* It isn't in prev_states, but maybe it's in the sort margin */        \
-        pos_ptr = (fcs_state_with_locations_t * *)freecell_solver_bsearch(              \
+        pos_ptr = (fcs_state_with_locations_t * *)fc_solve_bsearch(              \
             &new_state,                                                     \
             instance->indirect_prev_states_margin,                          \
             instance->num_prev_states_margin,                               \
             sizeof(fcs_state_with_locations_t *),                           \
-            freecell_solver_state_compare_indirect_with_context, \
+            fc_solve_state_compare_indirect_with_context, \
             NULL,                  \
             &found);              \
                              \
                     instance->indirect_prev_states = realloc(instance->indirect_prev_states, sizeof(fcs_state_with_locations_t *) * instance->max_num_indirect_prev_states);       \
                 }             \
                             \
-                freecell_solver_merge_large_and_small_sorted_arrays(           \
+                fc_solve_merge_large_and_small_sorted_arrays(           \
                     instance->indirect_prev_states,              \
                     instance->num_indirect_prev_states,           \
                     instance->indirect_prev_states_margin,          \
                     instance->num_prev_states_margin,              \
                     sizeof(fcs_state_with_locations_t *),           \
-                    freecell_solver_state_compare_indirect_with_context,          \
+                    fc_solve_state_compare_indirect_with_context,          \
                     NULL                        \
                 );                   \
                                   \
 #endif
 
 #ifdef INDIRECT_STACK_STATES
-static void GCC_INLINE freecell_solver_cache_stacks(
-        freecell_solver_hard_thread_t * hard_thread,
+static void GCC_INLINE fc_solve_cache_stacks(
+        fc_solve_hard_thread_t * hard_thread,
         fcs_state_with_locations_t * new_state
         )
 {
 #endif
     void * cached_stack;
     char * new_ptr;
-    freecell_solver_instance_t * instance = hard_thread->instance;
+    fc_solve_instance_t * instance = hard_thread->instance;
     int stacks_num = instance->stacks_num;
     
 
             hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1)));
         }
 
-        cached_stack = (void *)freecell_solver_hash_insert(
+        cached_stack = (void *)fc_solve_hash_insert(
             instance->stacks_hash,
             new_state->s.stacks[a],
             freecell_solver_lookup2_hash_function(
     }
 }
 #else
-#define freecell_solver_cache_stacks(instance, new_state)
+#define fc_solve_cache_stacks(instance, new_state)
 #endif
 
 
 #ifdef FCS_WITH_TALONS
-void freecell_solver_cache_talon(
-    freecell_solver_instance_t * instance,
+void fc_solve_cache_talon(
+    fc_solve_instance_t * instance,
     fcs_state_with_locations_t * new_state
     )
 {
         hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1)));
     }
 
-    cached_talon = (void *)freecell_solver_hash_insert(
+    cached_talon = (void *)fc_solve_hash_insert(
         instance->talons_hash,
         new_state->s.talon,
         hash_value_int,
 
 
 #if (FCS_STATE_STORAGE == FCS_STATE_STORAGE_GLIB_HASH)
-guint freecell_solver_hash_function(gconstpointer key)
+guint fc_solve_hash_function(gconstpointer key)
 {
     guint hash_value;
     const char * s_ptr = (char*)key;
  *
  * */
 
-GCC_INLINE int freecell_solver_check_and_add_state(
-    freecell_solver_soft_thread_t * soft_thread,
+GCC_INLINE int fc_solve_check_and_add_state(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * new_state,
     fcs_state_with_locations_t * * existing_state
     )
     fcs_state_with_locations_t * * pos_ptr;
     int found;
 #endif
-    freecell_solver_hard_thread_t * hard_thread = soft_thread->hard_thread;
-    freecell_solver_instance_t * instance = hard_thread->instance;
+    fc_solve_hard_thread_t * hard_thread = soft_thread->hard_thread;
+    fc_solve_instance_t * instance = hard_thread->instance;
 
     int check;
 
         return FCS_STATE_BEGIN_SUSPEND_PROCESS;
     }
 
-    freecell_solver_cache_stacks(hard_thread, new_state);
+    fc_solve_cache_stacks(hard_thread, new_state);
 
     fcs_canonize_state(new_state, instance->freecells_num, instance->stacks_num);
 
         if (new_state->moves_to_parent != NULL)
         {
             new_state->moves_to_parent = 
-                freecell_solver_move_stack_compact_allocate(
+                fc_solve_move_stack_compact_allocate(
                     hard_thread, 
                     new_state->moves_to_parent
                     );
 
 static char meaningless_data[16] = "Hello World!";
 
-int freecell_solver_check_and_add_state(freecell_solver_instance_t * instance, fcs_state_with_locations_t * new_state, int depth)
+int fc_solve_check_and_add_state(fc_solve_instance_t * instance, fcs_state_with_locations_t * new_state, int depth)
 {
     DBT key, value;
 
 
     fcs_canonize_state(new_state, instance->freecells_num, instance->stacks_num);
 
-    freecell_solver_cache_stacks(instance, new_state);
+    fc_solve_cache_stacks(instance, new_state);
 
     key.data = new_state;
     key.size = sizeof(*new_state);
             &key,
             &value,
             0);
-        if (freecell_solver_solve_for_state(instance, new_state, depth+1,0) == FCS_STATE_WAS_SOLVED)
+        if (fc_solve_solve_for_state(instance, new_state, depth+1,0) == FCS_STATE_WAS_SOLVED)
         {
             return FCS_STATE_WAS_SOLVED;
         }

File fc-solve/source/caas.h

  * Solver uses to solve a given board.
  * */
 
-extern int freecell_solver_check_and_add_state(
-    freecell_solver_soft_thread_t * soft_thread,
+extern int fc_solve_check_and_add_state(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * new_state,
     fcs_state_with_locations_t * * existing_state
     );

File fc-solve/source/cl_chop.c

 
 #define ARGS_MAN_GROW_BY 30
 
-args_man_t * freecell_solver_args_man_alloc(void)
+args_man_t * fc_solve_args_man_alloc(void)
 {
     args_man_t * ret;
     ret = malloc(sizeof(args_man_t));
     return ret;
 }
 
-void freecell_solver_args_man_free(args_man_t * manager)
+void fc_solve_args_man_free(args_man_t * manager)
 {
     int a;
     for(a=0;a<manager->argc;a++)
 #define is_whitespace(c) \
     (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r'))
 
-int freecell_solver_args_man_chop(args_man_t * manager, char * string)
+int fc_solve_args_man_chop(args_man_t * manager, char * string)
 {
     char * s = string;
     char * new_arg;

File fc-solve/source/cl_chop.h

 
 typedef struct args_man_struct args_man_t;
 
-extern args_man_t * freecell_solver_args_man_alloc(void);
-extern void freecell_solver_args_man_free(args_man_t * manager);
-extern int freecell_solver_args_man_chop(args_man_t * manager, char * string);
+extern args_man_t * fc_solve_args_man_alloc(void);
+extern void fc_solve_args_man_free(args_man_t * manager);
+extern int fc_solve_args_man_chop(args_man_t * manager, char * string);
 
 #endif /* #ifndef FC_SOLVE__CMD_LINE_CHOP_H */
 

File fc-solve/source/cmd_line.c

             {
                 if (read_next_preset)
                 {
-                    *args = freecell_solver_args_man_alloc();
-                    freecell_solver_args_man_chop(*args, line+8);
+                    *args = fc_solve_args_man_alloc();
+                    fc_solve_args_man_chop(*args, line+8);
                     ret_code = 0;
                     goto HAVE_PRESET;
                 }
                 fclose(f);
                 buffer[num_read] = '\0';
 
-                args_man = freecell_solver_args_man_alloc();
-                ret = freecell_solver_args_man_chop(args_man, buffer);
+                args_man = fc_solve_args_man_alloc();
+                ret = fc_solve_args_man_chop(args_man, buffer);
                 free(buffer);
                 if (ret != 0)
                 {
                     *error_string =
                         strdup("Could not parse the file. Quitting\n");
-                    freecell_solver_args_man_free(args_man);
+                    fc_solve_args_man_free(args_man);
 
                     RET_ERROR_IN_ARG() ;
                 }
                     }
                     else if (ret != FCS_CMD_LINE_OK)
                     {
-                        freecell_solver_args_man_free(args_man);
+                        fc_solve_args_man_free(args_man);
                         return ret;
                     }
                 }
-                freecell_solver_args_man_free(args_man);
+                fc_solve_args_man_free(args_man);
             }
         }
         break;
                     {
                         free(dir);
                     }
-                    freecell_solver_args_man_free(preset_args);
+                    fc_solve_args_man_free(preset_args);
 
                     if (ret == FCS_CMD_LINE_UNRECOGNIZED_OPTION)
                     {

File fc-solve/source/fcs.h

 /*
- * fcs.h - header file of freecell_solver_instance and of user-level
+ * fcs.h - header file of fc_solve_instance and of user-level
  * functions for Freecell Solver
  *
  * Written by Shlomi Fish ( http://www.shlomifish.org/ ), 2000
 
 /*
  * Declare these structures because they will be used within
- * freecell_solver_instance, and they will contain a pointer to it.
+ * fc_solve_instance, and they will contain a pointer to it.
  * */
-struct freecell_solver_hard_thread_struct;
-struct freecell_solver_soft_thread_struct;
+struct fc_solve_hard_thread_struct;
+struct fc_solve_soft_thread_struct;
 
-typedef struct freecell_solver_hard_thread_struct freecell_solver_hard_thread_t;
+typedef struct fc_solve_hard_thread_struct fc_solve_hard_thread_t;
 
 struct fcs_tests_order_struct
 {
 
 typedef struct fcs_tests_order_struct fcs_tests_order_t;
 
-typedef struct freecell_solver_instance
+typedef struct fc_solve_instance
 {
 #if (FCS_STATE_STORAGE == FCS_STATE_STORAGE_INDIRECT)
     /* The sort-margin */
     int max_num_states_in_collection;
 
     int num_hard_threads;
-    struct freecell_solver_hard_thread_struct * * hard_threads;
+    struct fc_solve_hard_thread_struct * * hard_threads;
 
     /*
      * The next ID to allocate for a soft-thread.
     /*
      * This is the hard-thread used for the optimization scan.
      * */
-    struct freecell_solver_hard_thread_struct * optimization_thread;
+    struct fc_solve_hard_thread_struct * optimization_thread;
 
     /*
      * A counter that determines how many of the hard threads that belong
      * */
     int scans_synergy;
 
-} freecell_solver_instance_t;
+} fc_solve_instance_t;
 
 
 
 typedef struct fcs_prelude_item_struct fcs_prelude_item_t;
 
 
-struct freecell_solver_hard_thread_struct
+struct fc_solve_hard_thread_struct
 {
-    freecell_solver_instance_t * instance;
+    fc_solve_instance_t * instance;
 
     int num_soft_threads;
-    struct freecell_solver_soft_thread_struct * * soft_threads;
+    struct fc_solve_soft_thread_struct * * soft_threads;
 
     /*
      * The State Packs variables are used by all the state cache
 
 typedef struct fcs_soft_dfs_stack_item_struct fcs_soft_dfs_stack_item_t;
 
-struct freecell_solver_soft_thread_struct
+struct fc_solve_soft_thread_struct
 {
-    freecell_solver_hard_thread_t * hard_thread;
+    fc_solve_hard_thread_t * hard_thread;
 
     /*
      * The ID of the soft thread inside the instance.
     char * name;
 };
 
-typedef struct freecell_solver_soft_thread_struct freecell_solver_soft_thread_t;
+typedef struct fc_solve_soft_thread_struct fc_solve_soft_thread_t;
 
 
 #define FCS_SOFT_DFS_STATES_TO_CHECK_GROW_BY 32
 #define FCS_A_STAR_WEIGHT_SEQS_OVER_RENEGADE_CARDS 3
 #define FCS_A_STAR_WEIGHT_DEPTH 4
 
-freecell_solver_instance_t * freecell_solver_alloc_instance(void);
+fc_solve_instance_t * fc_solve_alloc_instance(void);
 
-extern void freecell_solver_init_instance(
-    freecell_solver_instance_t * instance
+extern void fc_solve_init_instance(
+    fc_solve_instance_t * instance
     );
 
-extern void freecell_solver_free_instance(
-    freecell_solver_instance_t * instance
+extern void fc_solve_free_instance(
+    fc_solve_instance_t * instance
     );
 
-extern void freecell_solver_finish_instance(
-    freecell_solver_instance_t * instance
+extern void fc_solve_finish_instance(
+    fc_solve_instance_t * instance
     );
 
-extern int freecell_solver_solve_instance(
-    freecell_solver_instance_t * instance,
+extern int fc_solve_solve_instance(
+    fc_solve_instance_t * instance,
     fcs_state_with_locations_t * init_state
     );
 
-extern int freecell_solver_resume_instance(
-    freecell_solver_instance_t * instance
+extern int fc_solve_resume_instance(
+    fc_solve_instance_t * instance
     );
 
-extern void freecell_solver_unresume_instance(
-    freecell_solver_instance_t * instance
+extern void fc_solve_unresume_instance(
+    fc_solve_instance_t * instance
     );
 
-extern freecell_solver_soft_thread_t * freecell_solver_instance_get_soft_thread(
-    freecell_solver_instance_t * instance,
+extern fc_solve_soft_thread_t * fc_solve_instance_get_soft_thread(
+    fc_solve_instance_t * instance,
     int ht_idx,
     int st_idx
     );
 
-extern freecell_solver_soft_thread_t * freecell_solver_new_soft_thread(
-    freecell_solver_soft_thread_t * soft_thread
+extern fc_solve_soft_thread_t * fc_solve_new_soft_thread(
+    fc_solve_soft_thread_t * soft_thread
     );
 
-extern freecell_solver_soft_thread_t * freecell_solver_new_hard_thread(
-    freecell_solver_instance_t * instance
+extern fc_solve_soft_thread_t * fc_solve_new_hard_thread(
+    fc_solve_instance_t * instance
     );
 
-extern int freecell_solver_hard_dfs_solve_for_state(
-    freecell_solver_soft_thread_t * soft_thread,
+extern int fc_solve_hard_dfs_solve_for_state(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * ptr_state_with_locations,
     int depth,
     int ignore_osins
     );
 
-extern int freecell_solver_soft_dfs_solve(
-    freecell_solver_soft_thread_t * soft_thread,
+extern int fc_solve_soft_dfs_solve(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * ptr_state_with_locations_orig
     );
 
-extern int freecell_solver_random_dfs_solve(
-    freecell_solver_soft_thread_t * soft_thread,
+extern int fc_solve_random_dfs_solve(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * ptr_state_with_locations_orig
     );
 
 
-extern void freecell_solver_a_star_initialize_rater(
-    freecell_solver_soft_thread_t * soft_thread,
+extern void fc_solve_a_star_initialize_rater(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * ptr_state_with_locations
     );
 
-extern int freecell_solver_a_star_or_bfs_do_solve_or_resume(
-    freecell_solver_soft_thread_t * soft_thread,
+extern int fc_solve_a_star_or_bfs_do_solve_or_resume(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * ptr_state_with_locations_orig,
     int resume
     );
 
-extern int freecell_solver_hard_dfs_resume_solution(
-    freecell_solver_soft_thread_t * soft_thread,
+extern int fc_solve_hard_dfs_resume_solution(
+    fc_solve_soft_thread_t * soft_thread,
     int depth
     );
 
-extern int freecell_solver_soft_dfs_resume_solution(
-    freecell_solver_soft_thread_t * soft_thread
+extern int fc_solve_soft_dfs_resume_solution(
+    fc_solve_soft_thread_t * soft_thread
     );
 
-extern int freecell_solver_random_dfs_resume_solution(
-    freecell_solver_soft_thread_t * soft_thread
+extern int fc_solve_random_dfs_resume_solution(
+    fc_solve_soft_thread_t * soft_thread
     );
 
 
-extern int freecell_solver_a_star_or_bfs_solve(
-    freecell_solver_soft_thread_t * soft_thread,
+extern int fc_solve_a_star_or_bfs_solve(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * ptr_state_with_locations_orig
     );
 
-extern int freecell_solver_a_star_or_bfs_resume_solution(
-    freecell_solver_soft_thread_t * soft_thread
+extern int fc_solve_a_star_or_bfs_resume_solution(
+    fc_solve_soft_thread_t * soft_thread
     );
 
-extern int freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume(
-    freecell_solver_soft_thread_t * soft_thread,
+extern int fc_solve_soft_dfs_or_random_dfs_do_solve_or_resume(
+    fc_solve_soft_thread_t * soft_thread,
     fcs_state_with_locations_t * ptr_state_with_locations_orig,
     int resume,
     int to_randomize
     );
 
-extern void freecell_solver_recycle_instance(
-    freecell_solver_instance_t * instance
+extern void fc_solve_recycle_instance(
+    fc_solve_instance_t * instance
         );
 
 #ifdef __cplusplus

File fc-solve/source/fcs_dm.c

 #endif
 
 /*
-    freecell_solver_bsearch - an improved binary search function. Highlights:
+    fc_solve_bsearch - an improved binary search function. Highlights:
 
     * The comparison function accepts a common context argument that
     is passed to SFO_bsearch.
     it should be placed, while setting *found to 0. If it was found
       (*found) is set to 1.
 */
-void * freecell_solver_bsearch
+void * fc_solve_bsearch
 (
     void * key,
     void * void_array,
 
 
 /*
-    freecell_solver_merge_large_and_small_sorted_array - merges a large sorted
+    fc_solve_merge_large_and_small_sorted_array - merges a large sorted
     array with a small sorted array. The arrays could be of any length
     whatsoever, but it works faster if the first is significantly bigger
     than the second.
     The array should be distinct or else there would be unexpected
     results.
 */
-int freecell_solver_merge_large_and_small_sorted_arrays
+int fc_solve_merge_large_and_small_sorted_arrays
 (
     void * void_big_array,
     size_t size_big_array,
 
     for(item_to_move = size_small_array-1 ; item_to_move>=0; item_to_move--)
     {
-        pos_ptr = freecell_solver_bsearch (
+        pos_ptr = fc_solve_bsearch (
             small_array+item_to_move*width,
             big_array,
             size_big_array-num_big_items_moved,

File fc-solve/source/fcs_dm.h

 #include <stddef.h>
 
 
-void * freecell_solver_bsearch
+void * fc_solve_bsearch
 (
     void * key,
     void * void_array,
     int * found
 );
 
-int freecell_solver_merge_large_and_small_sorted_arrays
+int fc_solve_merge_large_and_small_sorted_arrays
 (
     void * void_big_array,
     size_t size_big_array,

File fc-solve/source/fcs_enums.h

     FCS_TALON_KLONDIKE
 };
 
-enum freecell_solver_state_solving_return_codes
+enum fc_solve_state_solving_return_codes
 {
     FCS_STATE_WAS_SOLVED,
     FCS_STATE_IS_NOT_SOLVEABLE,

File fc-solve/source/fcs_hash.c

 
 
 
-SFO_hash_t * freecell_solver_hash_init(
+SFO_hash_t * fc_solve_hash_init(
     SFO_hash_value_t wanted_size,
     int (*compare_function)(const void * key1, const void * key2, void * context),
     void * context
        that the cork of the linked list is right at the start */
     memset(hash->entries, 0, sizeof(SFO_hash_symlink_t)*size);
 
-    hash->allocator = freecell_solver_compact_allocator_new();
+    hash->allocator = fc_solve_compact_allocator_new();
 
     return hash;
 }
 
-void * freecell_solver_hash_insert(
+void * fc_solve_hash_insert(
     SFO_hash_t * hash,
     void * key,
     SFO_hash_value_t hash_value,
     return NULL;
 }
 
-void freecell_solver_hash_free_with_callback(
+void fc_solve_hash_free_with_callback(
     SFO_hash_t * hash,
     void (*function_ptr)(void * key, void * context)
     )
         }
     }
 
-    freecell_solver_hash_free(hash);
+    fc_solve_hash_free(hash);
 }
 
-void freecell_solver_hash_free(
+void fc_solve_hash_free(
     SFO_hash_t * hash
     )
 {
-    freecell_solver_compact_allocator_finish(hash->allocator);
+    fc_solve_compact_allocator_finish(hash->allocator);
 
     free(hash->entries);
 
 
 #if 0
     /* Allocate a new hash with hash_init() */
-    new_hash = freecell_solver_hash_init_proto(
+    new_hash = fc_solve_hash_init_proto(
         old_size * 2,
         hash->compare_function,
         hash->context
 #else
 
 /* ANSI C doesn't allow empty compilation */
-static void freecell_solver_hash_c_dummy(); 
+static void fc_solve_hash_c_dummy(); 
 
 #endif /* (FCS_STATE_STORAGE == FCS_STATE_STORAGE_INTERNAL_HASH) || defined(INDIRECT_STACK_STATES) */

File fc-solve/source/fcs_hash.h

 typedef struct SFO_hash_struct SFO_hash_t;
 
 
-SFO_hash_t * freecell_solver_hash_init(
+SFO_hash_t * fc_solve_hash_init(
     SFO_hash_value_t wanted_size,
     int (*compare_function)(const void * key1, const void * key2, void * context),
     void * context
     );
 
-void * freecell_solver_hash_insert(
+void * fc_solve_hash_insert(
     SFO_hash_t * hash,
     void * key,
     SFO_hash_value_t hash_value,
     );
 
 
-void freecell_solver_hash_free(
+void fc_solve_hash_free(
     SFO_hash_t * hash
     );
 
-void freecell_solver_hash_free_with_callback(
+void fc_solve_hash_free_with_callback(
     SFO_hash_t * hash,
     void (*function_ptr)(void * key, void * context)
     );

File fc-solve/source/fcs_isa.c

 #include "dmalloc.h"
 #endif
 
-void freecell_solver_state_ia_init(freecell_solver_hard_thread_t * hard_thread)
+void fc_solve_state_ia_init(fc_solve_hard_thread_t * hard_thread)
 {
     hard_thread->max_num_state_packs = IA_STATE_PACKS_GROW_BY;
     hard_thread->state_packs = (fcs_state_with_locations_t * *)malloc(sizeof(fcs_state_with_locations_t *) * hard_thread->max_num_state_packs);
 }
 
 #if 0
-fcs_state_with_locations_t * fcs_state_ia_alloc(freecell_solver_hard_thread_t * hard_thread)
+fcs_state_with_locations_t * fcs_state_ia_alloc(fc_solve_hard_thread_t * hard_thread)
 {
     if (hard_thread->num_states_in_last_pack == hard_thread->state_pack_len)
     {
 #endif
 
 #if 0
-void fcs_state_ia_release(freecell_solver_hard_thread_t * hard_thread)
+void fcs_state_ia_release(fc_solve_hard_thread_t * hard_thread)
 {
     hard_thread->num_states_in_last_pack--;
 }
 #endif
 
-void freecell_solver_state_ia_finish(freecell_solver_hard_thread_t * hard_thread)
+void fc_solve_state_ia_finish(fc_solve_hard_thread_t * hard_thread)
 {
     int a;
     for(a=0;a<hard_thread->num_state_packs;a++)
     hard_thread->state_packs = NULL;
 }
 
-void freecell_solver_state_ia_foreach(freecell_solver_hard_thread_t * hard_thread, void (*ptr_function)(fcs_state_with_locations_t *, void *), void * context)
+void fc_solve_state_ia_foreach(fc_solve_hard_thread_t * hard_thread, void (*ptr_function)(fcs_state_with_locations_t *, void *), void * context)
 {
     int p,s;
     for(p=0;p<hard_thread->num_state_packs-1;p++)

File fc-solve/source/fcs_isa.h

 #include "state.h"
 #include "fcs.h"
 
-extern void freecell_solver_state_ia_init(freecell_solver_hard_thread_t * hard_thread);
+extern void fc_solve_state_ia_init(fc_solve_hard_thread_t * hard_thread);
 #if 0
-extern fcs_state_with_locations_t * fcs_state_ia_alloc(freecell_solver_instance_t * instance);
+extern fcs_state_with_locations_t * fcs_state_ia_alloc(fc_solve_instance_t * instance);
 #else
 
 #define fcs_state_ia_alloc_into_var(ret, instance) \
 
 
 #if 0
-extern void fcs_state_ia_release(freecell_solver_instance_t * instance);
+extern void fcs_state_ia_release(fc_solve_instance_t * instance);
 #else
 #define fcs_state_ia_release(instance)      \
 {                                           \
 
 
 #endif
-extern void freecell_solver_state_ia_finish(freecell_solver_hard_thread_t * hard_thread);
+extern void fc_solve_state_ia_finish(fc_solve_hard_thread_t * hard_thread);
 
-extern void freecell_solver_state_ia_foreach(
-        freecell_solver_hard_thread_t * hard_thread,
+extern void fc_solve_state_ia_foreach(
+        fc_solve_hard_thread_t * hard_thread,
         void (*ptr_function)(fcs_state_with_locations_t *, void *),
         void * context
         );

File fc-solve/source/freecell.c

  * This function tries to move stack cards that are present at the
  * top of stacks to the foundations.
  * */
-int freecell_solver_sfs_move_top_stack_cards_to_founds(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_top_stack_cards_to_founds(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
  * This test moves single cards that are present in the freecells to
  * the foundations.
  * */
-int freecell_solver_sfs_move_freecell_cards_to_founds(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_freecell_cards_to_founds(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     return FCS_STATE_IS_NOT_SOLVEABLE;
 }
 
-int freecell_solver_sfs_move_freecell_cards_on_top_of_stacks(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_freecell_cards_on_top_of_stacks(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 
 
 
-int freecell_solver_sfs_move_non_top_stack_cards_to_founds(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_non_top_stack_cards_to_founds(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 
 
 
-int freecell_solver_sfs_move_stack_cards_to_a_parent_on_the_same_stack(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_stack_cards_to_a_parent_on_the_same_stack(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 #undef ds
 
 
-int freecell_solver_sfs_move_stack_cards_to_different_stacks(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_stack_cards_to_different_stacks(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 
 
 
-int freecell_solver_sfs_move_sequences_to_free_stacks(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_sequences_to_free_stacks(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 
 
 
-int freecell_solver_sfs_move_freecell_cards_to_empty_stack(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_freecell_cards_to_empty_stack(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     return FCS_STATE_IS_NOT_SOLVEABLE;
 }
 
-int freecell_solver_sfs_move_cards_to_a_different_parent(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_move_cards_to_a_different_parent(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 
 
 
-int freecell_solver_sfs_empty_stack_into_freecells(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_empty_stack_into_freecells(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 
 }
 
-int freecell_solver_sfs_yukon_do_nothing(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_yukon_do_nothing(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     return FCS_STATE_IS_NOT_SOLVEABLE;
 }
 
-int freecell_solver_sfs_yukon_move_card_to_parent(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_yukon_move_card_to_parent(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     return FCS_STATE_IS_NOT_SOLVEABLE;
 }
 
-int freecell_solver_sfs_yukon_move_kings_to_empty_stack(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_yukon_move_kings_to_empty_stack(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     Let's try to deal the Gypsy-type Talon.
 
   */
-int freecell_solver_sfs_deal_gypsy_talon(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_deal_gypsy_talon(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 }
 
 
-int freecell_solver_sfs_get_card_from_klondike_talon(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_get_card_from_klondike_talon(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
        
 #endif
 
-int freecell_solver_sfs_atomic_move_card_to_empty_stack(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_atomic_move_card_to_empty_stack(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     return FCS_STATE_IS_NOT_SOLVEABLE;
 }
 
-int freecell_solver_sfs_atomic_move_card_to_parent(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_atomic_move_card_to_parent(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     return FCS_STATE_IS_NOT_SOLVEABLE;
 }
 
-int freecell_solver_sfs_atomic_move_card_to_freecell(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_atomic_move_card_to_freecell(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     return FCS_STATE_IS_NOT_SOLVEABLE;
 }
 
-int freecell_solver_sfs_atomic_move_freecell_card_to_parent(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_atomic_move_freecell_card_to_parent(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
     return FCS_STATE_IS_NOT_SOLVEABLE;
 }
 
-int freecell_solver_sfs_atomic_move_freecell_card_to_empty_stack(
-        freecell_solver_soft_thread_t * soft_thread,
+int fc_solve_sfs_atomic_move_freecell_card_to_empty_stack(
+        fc_solve_soft_thread_t * soft_thread,
         fcs_state_with_locations_t * ptr_state_with_locations,
         int num_freestacks,
         int num_freecells,
 #undef new_state
 
 
-freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TESTS_NUM] =
+fc_solve_solve_for_state_test_t fc_solve_sfs_tests[FCS_TESTS_NUM] =
 {
-    freecell_solver_sfs_move_top_stack_cards_to_founds,
-    freecell_solver_sfs_move_freecell_cards_to_founds,
-    freecell_solver_sfs_move_freecell_cards_on_top_of_stacks,
-    freecell_solver_sfs_move_non_top_stack_cards_to_founds,
-    freecell_solver_sfs_move_stack_cards_to_different_stacks,
-    freecell_solver_sfs_move_stack_cards_to_a_parent_on_the_same_stack,
-    freecell_solver_sfs_move_sequences_to_free_stacks,
-    freecell_solver_sfs_move_freecell_cards_to_empty_stack,
-    freecell_solver_sfs_move_cards_to_a_different_parent,
-    freecell_solver_sfs_empty_stack_into_freecells,
-    freecell_solver_sfs_simple_simon_move_sequence_to_founds,
-    freecell_solver_sfs_simple_simon_move_sequence_to_true_parent,
-    freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent,
-    freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_cards_above,
-    freecell_solver_sfs_simple_simon_move_sequence_with_some_cards_above_to_true_parent,
-    freecell_solver_sfs_simple_simon_move_sequence_with_junk_seq_above_to_true_parent_with_some_cards_above,
-    freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_with_some_cards_above,
-    freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack,
-    freecell_solver_sfs_atomic_move_card_to_empty_stack,
-    freecell_solver_sfs_atomic_move_card_to_parent,
-    freecell_solver_sfs_atomic_move_card_to_freecell,
-    freecell_solver_sfs_atomic_move_freecell_card_to_parent,
-    freecell_solver_sfs_atomic_move_freecell_card_to_empty_stack,
+    fc_solve_sfs_move_top_stack_cards_to_founds,
+    fc_solve_sfs_move_freecell_cards_to_founds,
+    fc_solve_sfs_move_freecell_cards_on_top_of_stacks,
+    fc_solve_sfs_move_non_top_stack_cards_to_founds,
+    fc_solve_sfs_move_stack_cards_to_different_stacks,
+    fc_solve_sfs_move_stack_cards_to_a_parent_on_the_same_stack,
+    fc_solve_sfs_move_sequences_to_free_stacks,
+    fc_solve_sfs_move_freecell_cards_to_empty_stack,
+    fc_solve_sfs_move_cards_to_a_different_parent,
+    fc_solve_sfs_empty_stack_into_freecells,
+    fc_solve_sfs_simple_simon_move_sequence_to_founds,
+    fc_solve_sfs_simple_simon_move_sequence_to_true_parent,
+    fc_solve_sfs_simple_simon_move_whole_stack_sequence_to_false_parent,
+    fc_solve_sfs_simple_simon_move_sequence_to_true_parent_with_some_cards_above,
+    fc_solve_sfs_simple_simon_move_sequence_with_some_cards_above_to_true_parent,
+    fc_solve_sfs_simple_simon_move_sequence_with_junk_seq_above_to_true_parent_with_some_cards_above,
+    fc_solve_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_with_some_cards_above,
+    fc_solve_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack,
+    fc_solve_sfs_atomic_move_card_to_empty_stack,
+    fc_solve_sfs_atomic_move_card_to_parent,
+    fc_solve_sfs_atomic_move_card_to_freecell,
+    fc_solve_sfs_atomic_move_freecell_card_to_parent,
+    fc_solve_sfs_atomic_move_freecell_card_to_empty_stack,
 #if 0
-    freecell_solver_sfs_move_top_stack_cards_to_founds,
-    freecell_solver_sfs_yukon_move_card_to_parent,
-    freecell_solver_sfs_yukon_move_kings_to_empty_stack,
-    freecell_solver_sfs_yukon_do_nothing,
-    freecell_solver_sfs_yukon_do_nothing,
+    fc_solve_sfs_move_top_stack_cards_to_founds,
+    fc_solve_sfs_yukon_move_card_to_parent,
+    fc_solve_sfs_yukon_move_kings_to_empty_stack,
+    fc_solve_sfs_yukon_do_nothing,
+    fc_solve_sfs_yukon_do_nothing,
 #endif
-    freecell_solver_sfs_yukon_do_nothing,
-    freecell_solver_sfs_yukon_do_nothing
+    fc_solve_sfs_yukon_do_nothing,
+    fc_solve_sfs_yukon_do_nothing
 #ifdef FCS_WITH_TALONS
         ,
-    freecell_solver_sfs_deal_gypsy_talon,
-    freecell_solver_sfs_get_card_from_klondike_talon
+    fc_solve_sfs_deal_gypsy_talon,
+    fc_solve_sfs_get_card_from_klondike_talon
 #endif
 };

File fc-solve/source/intrface.c

 
 /*
     General use of this interface:
-    1. freecell_solver_alloc_instance()
+    1. fc_solve_alloc_instance()
     2. Set the parameters of the game
     3. If you wish to revert, go to step #11.
-    4. freecell_solver_init_instance()
-    5. Call freecell_solver_solve_instance() with the initial board.
+    4. fc_solve_init_instance()
+    5. Call fc_solve_solve_instance() with the initial board.
     6. If it returns FCS_STATE_SUSPEND_PROCESS and you wish to proceed,
        then increase the iteration limit and call
-       freecell_solver_resume_instance().
+       fc_solve_resume_instance().
     7. Repeat Step #6 zero or more times.
     8. If the last call to solve_instance() or resume_instance() returned
        FCS_STATE_SUSPEND_PROCESS then call
-       freecell_solver_unresume_instance().
+       fc_solve_unresume_instance().
     9. If the solving was successful you can use the move stacks or the
        intermediate stacks. (Just don't destory them in any way).
-    10. Call freecell_solver_finish_instance().
-    11. Call freecell_solver_free_instance().
+    10. Call fc_solve_finish_instance().
+    11. Call fc_solve_free_instance().
 
     The library functions inside lib.c (a.k.a fcs_user()) give an
     easier approach for embedding Freecell Solver into your library. The
 */
 
 #if 0
-static const double freecell_solver_a_star_default_weights[5] = {0.5,0,0.5,0,0};
+static const double fc_solve_a_star_default_weights[5] = {0.5,0,0.5,0,0};
 #else
-static const double freecell_solver_a_star_default_weights[5] = {0.5,0,0.3,0,0.2};
+static const double fc_solve_a_star_default_weights[5] = {0.5,0,0.3,0,0.2};
 #endif
 
 
 
 
 
-static void freecell_solver_initialize_bfs_queue(freecell_solver_soft_thread_t * soft_thread)
+static void fc_solve_initialize_bfs_queue(fc_solve_soft_thread_t * soft_thread)
 {
     /* Initialize the BFS queue. We have one dummy element at the beginning
        in order to make operations simpler. */
 }
 
 static void foreach_soft_thread(
-    freecell_solver_instance_t * instance,
+    fc_solve_instance_t * instance,
     void (*soft_thread_callback)(
-        freecell_solver_soft_thread_t * soft_thread,
+        fc_solve_soft_thread_t * soft_thread,
         void * context
         ),
     void * context
 
 {
     int ht_idx, st_idx;
-    freecell_solver_hard_thread_t * hard_thread;
+    fc_solve_hard_thread_t * hard_thread;
     int num_soft_threads;
-    freecell_solver_soft_thread_t * * ht_soft_threads;
+    fc_solve_soft_thread_t * * ht_soft_threads;
     for(ht_idx = 0 ; ht_idx<instance->num_hard_threads; ht_idx++)
     {
         hard_thread = instance->hard_threads[ht_idx];
 
 
 static void soft_thread_clean_soft_dfs(
-    freecell_solver_soft_thread_t * soft_thread,
+    fc_solve_soft_thread_t * soft_thread,
     void * context
     )
 {
 }
 
 static void clean_soft_dfs(
-        freecell_solver_instance_t * instance
+        fc_solve_instance_t * instance
         )
 {
     foreach_soft_thread(instance, soft_thread_clean_soft_dfs, NULL);
 }
 
-static freecell_solver_soft_thread_t * alloc_soft_thread(
-        freecell_solver_hard_thread_t * hard_thread
+static fc_solve_soft_thread_t * alloc_soft_thread(
+        fc_solve_hard_thread_t * hard_thread
         )
 {
-    freecell_solver_soft_thread_t * soft_thread;
+    fc_solve_soft_thread_t * soft_thread;
     int a;
 
     /* Make sure we are not exceeding the maximal number of soft threads
         return NULL;
     }
 
-    soft_thread = malloc(sizeof(freecell_solver_soft_thread_t));
+    soft_thread = malloc(sizeof(fc_solve_soft_thread_t));
 
     soft_thread->hard_thread = hard_thread;
 
 
     soft_thread->orig_method = FCS_METHOD_NONE;
 
-    freecell_solver_initialize_bfs_queue(soft_thread);
+    fc_solve_initialize_bfs_queue(soft_thread);
 
     /* Initialize the priotity queue of the A* scan */
     soft_thread->a_star_pqueue = malloc(sizeof(PQUEUE));
-    freecell_solver_PQueueInitialise(
+    fc_solve_PQueueInitialise(
         soft_thread->a_star_pqueue,
         1024
         );
     /* Set the default A* weigths */
     for(a=0;a<(sizeof(soft_thread->a_star_weights)/sizeof(soft_thread->a_star_weights[0]));a++)
     {
-        soft_thread->a_star_weights[a] = freecell_solver_a_star_default_weights[a];
+        soft_thread->a_star_weights[a] = fc_solve_a_star_default_weights[a];
     }
 
-    soft_thread->rand_gen = freecell_solver_rand_alloc(soft_thread->rand_seed = 24);
+    soft_thread->rand_gen = fc_solve_rand_alloc(soft_thread->rand_seed = 24);
 
     soft_thread->initialized = 0;
 
 #if 0
     {
         char * no_use;
-        freecell_solver_apply_tests_order(soft_thread, "[01][23456789]", &no_use);
+        fc_solve_apply_tests_order(soft_thread, "[01][23456789]", &no_use);
     }
 #else
     soft_thread->tests_order.num = soft_thread->hard_thread->instance->instance_tests_order.num;
     return soft_thread;
 }
 
-static freecell_solver_hard_thread_t * alloc_hard_thread(
-        freecell_solver_instance_t * instance
+static fc_solve_hard_thread_t * alloc_hard_thread(
+        fc_solve_instance_t * instance
         )
 {
-    freecell_solver_hard_thread_t * hard_thread;
+    fc_solve_hard_thread_t * hard_thread;
 
     /* Make sure we are not exceeding the maximal number of soft threads
      * for an instance. */
         return NULL;
     }
 
-    hard_thread = malloc(sizeof(freecell_solver_hard_thread_t));
+    hard_thread = malloc(sizeof(fc_solve_hard_thread_t));
 
     hard_thread->instance = instance;
 
 
 #ifdef INDIRECT_STACK_STATES
     hard_thread->stacks_allocator = 
-        freecell_solver_compact_allocator_new();
+        fc_solve_compact_allocator_new();
 #endif
     hard_thread->move_stacks_allocator =
-        freecell_solver_compact_allocator_new();
+        fc_solve_compact_allocator_new();
 
     fcs_move_stack_alloc_into_var(hard_thread->reusable_move_stack);
 
     default values in it. After the call to this function, the program can
     set parameters in it which are different from the default.
 
-    Afterwards freecell_solver_init_instance() should be called in order
+    Afterwards fc_solve_init_instance() should be called in order
     to really prepare it for solving.
   */
-freecell_solver_instance_t * freecell_solver_alloc_instance(void)
+fc_solve_instance_t * fc_solve_alloc_instance(void)
 {
-    freecell_solver_instance_t * instance;
+    fc_solve_instance_t * instance;
 
-    instance = malloc(sizeof(freecell_solver_instance_t));
+    instance = malloc(sizeof(fc_solve_instance_t));
 
 #if (FCS_STATE_STORAGE == FCS_STATE_STORAGE_INDIRECT)
     instance->num_indirect_prev_states = 0;
 
     instance->num_hard_threads = 0;
 
-    freecell_solver_apply_preset_by_name(instance, "freecell");
+    fc_solve_apply_preset_by_name(instance, "freecell");
 
     /****************************************/
 
 
 
 
-static void free_bfs_queue(freecell_solver_soft_thread_t * soft_thread)
+static void free_bfs_queue(fc_solve_soft_thread_t * soft_thread)
 {
     /* Free the BFS linked list */
     fcs_states_linked_list_item_t * item, * next_item;
     }
 }
 
-static void free_instance_soft_thread_callback(freecell_solver_soft_thread_t * soft_thread, void * context)
+static void free_instance_soft_thread_callback(fc_solve_soft_thread_t * soft_thread, void * context)
 {
     free_bfs_queue(soft_thread);
-    freecell_solver_rand_free(soft_thread->rand_gen);
+    fc_solve_rand_free(soft_thread->rand_gen);
 
-    freecell_solver_PQueueFree(soft_thread->a_star_pqueue);
+    fc_solve_PQueueFree(soft_thread->a_star_pqueue);
     free(soft_thread->a_star_pqueue);
 
     free(soft_thread->tests_order.tests);
     free(soft_thread);
 }
 
-static void free_instance_hard_thread_callback(freecell_solver_hard_thread_t * hard_thread)
+static void free_instance_hard_thread_callback(fc_solve_hard_thread_t * hard_thread)
 {
     if (hard_thread->prelude_as_string)
     {
 
     if (hard_thread->move_stacks_allocator)
     {
-        freecell_solver_compact_allocator_finish(hard_thread->move_stacks_allocator);
+        fc_solve_compact_allocator_finish(hard_thread->move_stacks_allocator);
     }
 #ifdef INDIRECT_STACK_STATES
     if (hard_thread->stacks_allocator)
     {
-        freecell_solver_compact_allocator_finish(hard_thread->stacks_allocator);
+        fc_solve_compact_allocator_finish(hard_thread->stacks_allocator);
     }
 #endif
     free(hard_thread);    
     sequence of operations on instance, and it is meant for de-allocating
     whatever memory was allocated by alloc_instance().
   */
-void freecell_solver_free_instance(freecell_solver_instance_t * instance)
+void fc_solve_free_instance(fc_solve_instance_t * instance)
 {
     int ht_idx;
 
 
 
 static void normalize_a_star_weights(
-    freecell_solver_soft_thread_t * soft_thread,
+    fc_solve_soft_thread_t * soft_thread,
     void * context
     )
 {
     {
         if (soft_thread->a_star_weights[a] < 0)
         {
-            soft_thread->a_star_weights[a] = freecell_solver_a_star_default_weights[a];
+            soft_thread->a_star_weights[a] = fc_solve_a_star_default_weights[a];
         }
         sum += soft_thread->a_star_weights[a];
     }
 }
 
 static void accumulate_tests_order(
-    freecell_solver_soft_thread_t * soft_thread,
+    fc_solve_soft_thread_t * soft_thread,
     void * context
     )
 {
 }
 
 static void determine_scan_completeness(
-    freecell_solver_soft_thread_t * soft_thread,
+    fc_solve_soft_thread_t * soft_thread,
     void * context
     )
 {
 };
 
 static int compile_prelude(
-    freecell_solver_hard_thread_t * hard_thread
+    fc_solve_hard_thread_t * hard_thread
     )
 {
     char * p_quota, * p_scan, * p;
 }
 
 
-void freecell_solver_init_instance(freecell_solver_instance_t * instance)
+void fc_solve_init_instance(fc_solve_instance_t * instance)
 {
     int ht_idx;
-    freecell_solver_hard_thread_t * hard_thread;
+    fc_solve_hard_thread_t * hard_thread;
 #if (FCS_STATE_STORAGE == FCS_STATE_STORAGE_INDIRECT)
     instance->num_prev_states_margin = 0;
 
         }
         hard_thread->num_times_left_for_soft_thread =
             hard_thread->soft_threads[0]->num_times_step;
-        freecell_solver_state_ia_init(hard_thread);
+        fc_solve_state_ia_init(hard_thread);
     }
 
     /* Normalize the A* Weights, so the sum of all of them would be 1. */
 */
 #if defined(INDIRECT_STACK_STATES)
 
-extern int freecell_solver_stack_compare_for_comparison(const void * v_s1, const void * v_s2);
+extern int fc_solve_stack_compare_for_comparison(const void * v_s1, const void * v_s2);
 
 #if ((FCS_STACK_STORAGE != FCS_STACK_STORAGE_GLIB_TREE) && (FCS_STACK_STORAGE != FCS_STACK_STORAGE_GLIB_HASH))
 static int fcs_stack_compare_for_comparison_with_context(
 
     )
 {
-    return freecell_solver_stack_compare_for_comparison(v_s1, v_s2);
+    return fc_solve_stack_compare_for_comparison(v_s1, v_s2);
 }
 #endif
 
 
 #if (FCS_STACK_STORAGE == FCS_STACK_STORAGE_GLIB_HASH)
 /* A hash calculation function for use in glib's hash */
-static guint freecell_solver_glib_hash_stack_hash_function (
+static guint fc_solve_glib_hash_stack_hash_function (
     gconstpointer key
     )
 {
 
 
 
-static gint freecell_solver_glib_hash_stack_compare (
+static gint fc_solve_glib_hash_stack_compare (
     gconstpointer a,
     gconstpointer b
 )
  * This hash function is defined in caas.c
  *
  * */
-extern guint freecell_solver_hash_function(gconstpointer key);
+extern guint fc_solve_hash_function(gconstpointer key);
 #endif
 
 /*
  * to the initial state
  * */
 static void trace_solution(
-    freecell_solver_instance_t * instance
+    fc_solve_instance_t * instance
     )
 {
     /*
     This function optimizes the solution path using a BFS scan on the
     states in the solution path.
 */
-static int freecell_solver_optimize_solution(
-    freecell_solver_instance_t * instance
+static int fc_solve_optimize_solution(
+    fc_solve_instance_t * instance
     )
 {
-    freecell_solver_hard_thread_t * optimization_thread;
-    freecell_solver_soft_thread_t * soft_thread;
+    fc_solve_hard_thread_t * optimization_thread;
+    fc_solve_soft_thread_t * soft_thread;
     
     optimization_thread = alloc_hard_thread(instance);
     instance->optimization_thread = optimization_thread;
 
     /* Initialize the optimization hard-thread and soft-thread */
     optimization_thread->num_times_left_for_soft_thread = 1000000;
-    freecell_solver_state_ia_init(optimization_thread);
+    fc_solve_state_ia_init(optimization_thread);
 
     /* Instruct the optimization hard thread to run indefinitely AFA it
      * is concerned */
     optimization_thread->ht_max_num_times = -1;
 
     return 
-        freecell_solver_a_star_or_bfs_do_solve_or_resume(
+        fc_solve_a_star_or_bfs_do_solve_or_resume(
             optimization_thread->soft_threads[0],
             instance->state_copy_ptr,
             0
 }
 
 
-extern void freecell_solver_cache_talon(
-    freecell_solver_instance_t * instance,
+extern void fc_solve_cache_talon(
+    fc_solve_instance_t * instance,
     fcs_state_with_locations_t * new_state
     );
 
 /*
     This function starts the solution process _for the first time_. If one
     wishes to proceed after the iterations limit was reached, one should
-    use freecell_solver_resume_instance.
+    use fc_solve_resume_instance.
 
   */
-int freecell_solver_solve_instance(
-    freecell_solver_instance_t * instance,
+int fc_solve_solve_instance(
+    fc_solve_instance_t * instance,
     fcs_state_with_locations_t * init_state
     )
 {
 
     /* Initialize the data structure that will manage the state collection */
 #if (FCS_STATE_STORAGE == FCS_STATE_STORAGE_LIBREDBLACK_TREE)
-    instance->tree = rbinit(freecell_solver_state_compare_with_context, NULL);
+    instance->tree = rbinit(fc_solve_state_compare_with_context, NULL);
 #elif (FCS_STATE_STORAGE == FCS_STATE_STORAGE_LIBAVL_AVL_TREE)
-    instance->tree = avl_create(freecell_solver_state_compare_with_context, NULL);
+    instance->tree = avl_create(fc_solve_state_compare_with_context, NULL);
 #elif (FCS_STATE_STORAGE == FCS_STATE_STORAGE_LIBAVL_REDBLACK_TREE)
-    instance->tree = rb_create(freecell_solver_state_compare_with_context, NULL);
+    instance->tree = rb_create(fc_solve_state_compare_with_context, NULL);
 #elif (FCS_STATE_STORAGE == FCS_STATE_STORAGE_GLIB_TREE)
-    instance->tree = g_tree_new(freecell_solver_state_compare);
+    instance->tree = g_tree_new(fc_solve_state_compare);
 #endif
 
 #if (FCS_STATE_STORAGE == FCS_STATE_STORAGE_GLIB_HASH)
     instance->hash = g_hash_table_new(
-        freecell_solver_hash_function,
-        freecell_solver_state_compare_equal
+        fc_solve_hash_function,
+        fc_solve_state_compare_equal
         );
 #elif (FCS_STATE_STORAGE == FCS_STATE_STORAGE_INTERNAL_HASH)
-    instance->hash = freecell_solver_hash_init(
+    instance->hash = fc_solve_hash_init(
             2048,
-            freecell_solver_state_compare_with_context,
+            fc_solve_state_compare_with_context,
             NULL
        );
 #endif
     /* Initialize the data structure that will manage the stack
        collection */
 #if FCS_STACK_STORAGE == FCS_STACK_STORAGE_INTERNAL_HASH
-    instance->stacks_hash = freecell_solver_hash_init(
+    instance->stacks_hash = fc_solve_hash_init(
             2048,
             fcs_stack_compare_for_comparison_with_context,
             NULL
     instance->stacks_tree = g_tree_new(fcs_stack_compare_for_comparison);
 #elif (FCS_STACK_STORAGE == FCS_STACK_STORAGE_GLIB_HASH)
     instance->stacks_hash = g_hash_table_new(
-        freecell_solver_glib_hash_stack_hash_function,
-        freecell_solver_glib_hash_stack_compare
+        fc_solve_glib_hash_stack_hash_function,
+        fc_solve_glib_hash_stack_compare
         );
 #endif
 #endif
     /* Initialize the Talon's Cache */
     if (instance->talon_type == FCS_TALON_KLONDIKE)
     {
-        instance->talons_hash = freecell_solver_hash_init(
+        instance->talons_hash = fc_solve_hash_init(
             512,
             fcs_talon_compare_with_context,
             NULL
             );
 
-        freecell_solver_cache_talon(instance, instance->state_copy_ptr);
+        fc_solve_cache_talon(instance, instance->state_copy_ptr);
     }
 #endif
 
     {
         fcs_state_with_locations_t * no_use;
 
-        freecell_solver_check_and_add_state(
+        fc_solve_check_and_add_state(
             instance->hard_threads[0]->soft_threads[0],
             state_copy_ptr,
             &no_use
         int ht_idx;
         for(ht_idx=0; ht_idx < instance->num_hard_threads ; ht_idx++)
         {
-            freecell_solver_hard_thread_t * hard_thread;
+            fc_solve_hard_thread_t * hard_thread;
             hard_thread = instance->hard_threads[ht_idx];
             
             if (hard_thread->prelude != NULL)
         }
     }
 
-    return freecell_solver_resume_instance(instance);
+    return fc_solve_resume_instance(instance);
 }
 
 
-static int run_hard_thread(freecell_solver_hard_thread_t * hard_thread)
+static int run_hard_thread(fc_solve_hard_thread_t * hard_thread)
 {
-    freecell_solver_soft_thread_t * soft_thread;
+    fc_solve_soft_thread_t * soft_thread;
     int num_times_started_at;
     int ret;
-    freecell_solver_instance_t * instance = hard_thread->instance;
+    fc_solve_instance_t * instance = hard_thread->instance;
     /* 
      * Again, making sure that not all of the soft_threads in this 
      * hard thread are finished.
                 
             if (! soft_thread->initialized)
             {
-                ret = freecell_solver_hard_dfs_solve_for_state(
+                ret = fc_solve_hard_dfs_solve_for_state(
                     soft_thread,
                     instance->state_copy_ptr,
                     0,
             }
             else
             {
-                ret = freecell_solver_hard_dfs_resume_solution(soft_thread, 0);
+                ret = fc_solve_hard_dfs_resume_solution(soft_thread, 0);
             }
             break;
 
             if (! soft_thread->initialized)
             {
                 ret = 
-                    freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume(
+                    fc_solve_soft_dfs_or_random_dfs_do_solve_or_resume(
                         soft_thread,
                         instance->state_copy_ptr,
                         0,
             else
             {
                 ret = 
-                    freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume(
+                    fc_solve_soft_dfs_or_random_dfs_do_solve_or_resume(
                         soft_thread,
                         NULL,
                         1,
             if (! soft_thread->initialized)
             {
                 ret = 
-                    freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume(
+                    fc_solve_soft_dfs_or_random_dfs_do_solve_or_resume(
                         soft_thread,
                         instance->state_copy_ptr,
                         0,
             else
             {
                 ret = 
-                    freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume(
+                    fc_solve_soft_dfs_or_random_dfs_do_solve_or_resume(
                         soft_thread,
                         NULL,
                         1,
             {
                 if (soft_thread->method == FCS_METHOD_A_STAR)
                 {
-                    freecell_solver_a_star_initialize_rater(
+                    fc_solve_a_star_initialize_rater(
                         soft_thread,
                         instance->state_copy_ptr
                         );
                 }
 
-                ret = freecell_solver_a_star_or_bfs_do_solve_or_resume(
+                ret = fc_solve_a_star_or_bfs_do_solve_or_resume(
                     soft_thread,
                     instance->state_copy_ptr,
                     0
             else
             {
                 ret =
-                    freecell_solver_a_star_or_bfs_do_solve_or_resume(
+                    fc_solve_a_star_or_bfs_do_solve_or_resume(
                         soft_thread,
                         soft_thread->first_state_to_check,
                         1
 
 
 /* Resume a solution process that was stopped in the middle */
-int freecell_solver_resume_instance(
-    freecell_solver_instance_t * instance
+int fc_solve_resume_instance(
+    fc_solve_instance_t * instance
     )
 {
     int ret = FCS_STATE_SUSPEND_PROCESS;
-    freecell_solver_hard_thread_t * hard_thread;
+    fc_solve_hard_thread_t * hard_thread;
 
     /*
      * If the optimization thread is defined, it means we are in the 
     if (instance->optimization_thread)
     {
         ret =
-            freecell_solver_a_star_or_bfs_do_solve_or_resume(
+            fc_solve_a_star_or_bfs_do_solve_or_resume(
                 instance->optimization_thread->soft_threads[0],
                 instance->optimization_thread->soft_threads[0]->first_state_to_check,
                 1
              * it has already run - we retain the old ret. */
             if (! instance->optimization_thread)
             {
-                ret = freecell_solver_optimize_solution(instance);
+                ret = fc_solve_optimize_solution(instance);
             }
             if (ret == FCS_STATE_WAS_SOLVED)
             {
     This function does not substitute for later calling
     finish_instance() and free_instance().
   */
-void freecell_solver_unresume_instance(
-    freecell_solver_instance_t * instance
+void fc_solve_unresume_instance(
+    fc_solve_instance_t * instance
     )
 {
     /*
 
 #if (FCS_STATE_STORAGE == FCS_STATE_STORAGE_LIBAVL_AVL_TREE) || (FCS_STATE_STORAGE == FCS_STATE_STORAGE_LIBAVL_REDBLACK_TREE)
 
-static void freecell_solver_tree_do_nothing(void * data, void * context)
+static void fc_solve_tree_do_nothing(void * data, void * context)
 {
 }
 
 #ifdef INDIRECT_STACK_STATES
 #if (FCS_STACK_STORAGE == FCS_STACK_STORAGE_INTERNAL_HASH) || (FCS_STACK_STORAGE == FCS_STACK_STORAGE_LIBAVL_AVL_TREE) || (FCS_STACK_STORAGE == FCS_STACK_STORAGE_LIBAVL_REDBLACK_TREE)
 #if 0