~ubuntu-branches/ubuntu/saucy/freecell-solver/saucy

« back to all changes in this revision

Viewing changes to lib.c

  • Committer: Package Import Robot
  • Author(s): Gergely Risko
  • Date: 2012-06-22 10:08:05 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120622100805-evoda1ccdr8vt5xr
Tags: 3.12.0-1
New upstream version. (closes: #675262)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#include "preset.h"
39
39
#include "fcs_user.h"
40
40
#include "move_funcs_order.h"
 
41
#include "fcs_user_internal.h"
41
42
 
42
43
#include "unused.h"
43
44
#include "bool.h"
 
45
#include "indirect_buffer.h"
 
46
 
 
47
typedef struct {
 
48
    int num_times;
 
49
    int num_states_in_collection;
 
50
} fcs_stats_t;
44
51
 
45
52
/* A flare is an alternative scan algorithm to be tried. All flares in
46
53
 * a single instance are being evaluated and then one picks the shortest
112
119
    /*
113
120
     * The number of iterations this board started at.
114
121
     * */
115
 
    int iterations_board_started_at;
 
122
    fcs_stats_t iterations_board_started_at;
116
123
    /*
117
124
     * The number of iterations that the current instance started solving from.
118
125
     * */
119
 
    int init_num_times;
 
126
    fcs_stats_t init_num_times;
120
127
    /*
121
128
     * A pointer to the currently active instance out of the sequence
122
129
     * */
123
130
    fc_solve_instance_t * fc_solve_obj;
124
131
    fcs_state_keyval_pair_t state;
125
132
    fcs_state_keyval_pair_t running_state;
126
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
127
133
    fcs_state_locs_struct_t state_locs;
128
134
    fcs_state_locs_struct_t trace_solution_state_locs;
129
135
    fcs_state_locs_struct_t initial_state_locs;
130
 
#endif
131
136
    int ret_code;
132
137
    fcs_bool_t all_instances_were_suspended;
133
138
    int state_validity_ret;
137
142
 
138
143
    fc_solve_soft_thread_t * soft_thread;
139
144
 
140
 
#ifdef INDIRECT_STACK_STATES
141
 
    char indirect_stacks_buffer[MAX_NUM_STACKS << 7];
142
 
#endif
 
145
    DECLARE_IND_BUF_T(indirect_stacks_buffer)
143
146
    char * state_string_copy;
144
147
 
145
148
#ifndef FCS_FREECELL_ONLY
155
158
    int iter_num,
156
159
    int depth,
157
160
    void * lp_instance GCC_UNUSED,
158
 
#ifdef FCS_RCS_STATES
159
 
    fcs_state_t * ptr_state_key,
160
 
#endif
161
 
    fcs_collectible_state_t * ptr_state_val,
 
161
    fcs_kv_state_t * ptr_state,
162
162
    int parent_iter_num
163
163
    );
164
164
 
212
212
    user->current_iterations_limit = -1;
213
213
 
214
214
    user->state_string_copy = NULL;
215
 
    user->iterations_board_started_at = 0;
 
215
    user->iterations_board_started_at.num_times = 0;
 
216
    user->iterations_board_started_at.num_states_in_collection = 0;
216
217
    user->all_instances_were_suspended = TRUE;
217
218
 
218
219
    user->error_string = NULL;
260
261
 
261
262
    FLARES_LOOP_START()
262
263
        status = fc_solve_apply_preset_by_ptr(
263
 
            instance_item->flares[flare_idx].obj,
 
264
            flare->obj,
264
265
            new_preset_ptr
265
266
            );
266
267
 
312
313
    )
313
314
{
314
315
    fcs_user_t * user;
315
 
    fcs_instance_item_t * instance_item;
316
316
    int depth_idx;
317
317
    int ret_code;
318
318
 
319
319
    user = (fcs_user_t *)api_instance;
320
320
 
321
 
    instance_item = &(user->instances_list[user->current_instance_idx]);
322
 
 
323
321
    *error_string = NULL;
324
322
 
325
323
    if (min_depth < 0)
384
382
            error_string
385
383
            );
386
384
 
 
385
    {
 
386
        int further_depth_idx;
 
387
        for (further_depth_idx = depth_idx+1; further_depth_idx < user->soft_thread->by_depth_tests_order.num ; further_depth_idx++)
 
388
        {
 
389
            free(user->soft_thread->by_depth_tests_order.by_depth_tests[further_depth_idx].tests_order.tests);
 
390
            user->soft_thread->by_depth_tests_order.by_depth_tests[further_depth_idx].tests_order.tests = NULL;
 
391
        }
 
392
    }
 
393
 
387
394
    user->soft_thread->by_depth_tests_order.by_depth_tests =
388
395
        realloc(
389
396
            user->soft_thread->by_depth_tests_order.by_depth_tests,
766
773
             * not get initialized again, and now the num_times of the instance
767
774
             * is equal to 0.
768
775
             * */
769
 
            user->init_num_times = 0;
 
776
            user->init_num_times.num_times = 0;
 
777
            user->init_num_times.num_states_in_collection = 0;
770
778
 
771
779
            flare->ret_code = FCS_STATE_NOT_BEGAN_YET;
772
780
        }
789
797
    void * api_instance
790
798
    )
791
799
{
792
 
    int init_num_times;
 
800
    fcs_stats_t init_num_times;
793
801
    int run_for_first_iteration = 1;
794
802
    int ret;
795
803
    fcs_user_t * user;
876
884
        if (flare->ret_code == FCS_STATE_NOT_BEGAN_YET)
877
885
        {
878
886
            int status;
 
887
            fcs_kv_state_t state_pass;
879
888
 
880
889
#if (!(defined(HARD_CODED_NUM_FREECELLS) && defined(HARD_CODED_NUM_STACKS) && defined(HARD_CODED_NUM_DECKS)))
881
890
            fc_solve_instance_t * instance = user->fc_solve_obj;
886
895
                &(user->state),
887
896
                INSTANCE_FREECELLS_NUM,
888
897
                INSTANCE_STACKS_NUM,
889
 
                INSTANCE_DECKS_NUM
890
 
#ifdef FCS_WITH_TALONS
891
 
                ,user->fc_solve_obj->talon_type
892
 
#endif
893
 
#ifdef INDIRECT_STACK_STATES
894
 
                ,user->indirect_stacks_buffer
895
 
#endif
 
898
                INSTANCE_DECKS_NUM,
 
899
                user->indirect_stacks_buffer
896
900
                );
897
901
 
898
902
            if (status != FCS_USER_STATE_TO_C__SUCCESS)
907
911
                INSTANCE_FREECELLS_NUM,
908
912
                INSTANCE_STACKS_NUM,
909
913
                INSTANCE_DECKS_NUM,
910
 
#ifdef FCS_WITH_TALONS
911
 
                FCS_TALON_NONE,
912
 
#endif
913
914
                &(user->state_validity_card));
914
915
 
915
916
            if (user->state_validity_ret != FCS_STATE_VALIDITY__OK)
918
919
                return user->ret_code;
919
920
            }
920
921
 
921
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
922
 
            {
923
 
                int i;
924
 
                for ( i=0 ; i<MAX_NUM_STACKS ; i++)
925
 
                {
926
 
                    user->initial_state_locs.stack_locs[i] = (fcs_locs_t)i;
927
 
                }
928
 
                for ( i=0 ; i<MAX_NUM_FREECELLS ; i++)
929
 
                {
930
 
                    user->initial_state_locs.fc_locs[i] = (fcs_locs_t)i;
931
 
                }
932
 
            }
 
922
            fc_solve_init_locs(&(user->initial_state_locs));
933
923
            user->state_locs = user->initial_state_locs;
934
 
#endif
935
924
 
936
 
            /* running_state is a normalized state. So I'm duplicating
937
 
             * state to it before state is canonized
 
925
            state_pass.key = &(user->state.s);
 
926
            state_pass.val = &(user->state.info);
 
927
            /* running_state is a normalized state. So We're duplicating
 
928
             * state to it before state state_pass is canonized
938
929
             * */
939
 
            fcs_duplicate_state(
940
 
#ifdef FCS_RCS_STATES
941
 
                &(user->running_state.s),
942
 
                &(user->running_state.info),
943
 
                &(user->state.s),
944
 
                &(user->state.info)
945
 
#else
946
 
                &(user->running_state),
947
 
                &(user->state)
948
 
#endif
949
 
                );
950
 
 
951
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
952
 
#endif
953
 
 
954
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
 
930
            {
 
931
                fcs_kv_state_t pass;
 
932
                pass.key = &(user->running_state.s);
 
933
                pass.val = &(user->running_state.info);
 
934
 
 
935
                fcs_duplicate_kv_state(&pass, &state_pass);
 
936
            }
 
937
 
955
938
            fc_solve_canonize_state_with_locs
956
 
#else
957
 
            fc_solve_canonize_state
958
 
#endif
959
939
                (
960
 
#ifdef FCS_RCS_STATES
961
 
                &(user->state.s),
962
 
                &(user->state.info),
963
 
#else
964
 
                &(user->state),
965
 
#endif
966
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
 
940
                 &state_pass,
967
941
                &(user->state_locs),
968
 
#endif
969
942
                INSTANCE_FREECELLS_NUM,
970
943
                INSTANCE_STACKS_NUM
971
944
                );
972
945
 
973
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
974
946
            user->trace_solution_state_locs = user->state_locs;
975
 
#endif
976
947
 
977
948
            fc_solve_init_instance(user->fc_solve_obj);
978
949
 
980
951
        }
981
952
 
982
953
#define parameterized_fixed_limit(increment) \
983
 
    (user->iterations_board_started_at + increment)
 
954
    (user->iterations_board_started_at.num_times + increment)
984
955
#define parameterized_limit(increment) (((increment) < 0) ? (-1) : parameterized_fixed_limit(increment))
985
956
#define local_limit()  \
986
957
        (instance_item->limit)
995
966
            int mymin, new_lim;
996
967
 
997
968
            limits[0] = local_limit();
998
 
            limits[1] = parameterized_limit(user->current_iterations_limit);
 
969
            limits[1] = user->current_iterations_limit;
999
970
            limits[2] = parameterized_limit(flare_iters_quota);
1000
971
 
1001
972
            mymin = limits[0];
1017
988
            {
1018
989
                user->fc_solve_obj->max_num_times =
1019
990
                    user->fc_solve_obj->effective_max_num_times =
1020
 
                    (user->fc_solve_obj->num_times + mymin - user->iterations_board_started_at);
 
991
                    (user->fc_solve_obj->num_times + mymin - user->iterations_board_started_at.num_times);
1021
992
            }
1022
993
        }
1023
994
 
1024
 
        user->init_num_times = init_num_times = user->fc_solve_obj->num_times;
 
995
        user->init_num_times.num_times = init_num_times.num_times = user->fc_solve_obj->num_times;
 
996
        user->init_num_times.num_states_in_collection = init_num_times.num_states_in_collection = user->fc_solve_obj->num_states_in_collection;
1025
997
 
1026
998
        if (solve_start)
1027
999
        {
1038
1010
            user->all_instances_were_suspended = FALSE;
1039
1011
        }
1040
1012
 
1041
 
        user->iterations_board_started_at += user->fc_solve_obj->num_times - init_num_times;
1042
 
        user->init_num_times = user->fc_solve_obj->num_times;
 
1013
        user->iterations_board_started_at.num_times += user->fc_solve_obj->num_times - init_num_times.num_times;
 
1014
        user->iterations_board_started_at.num_states_in_collection += user->fc_solve_obj->num_states_in_collection - init_num_times.num_states_in_collection;
 
1015
        user->init_num_times.num_times = user->fc_solve_obj->num_times;
 
1016
        user->init_num_times.num_states_in_collection = user->fc_solve_obj->num_states_in_collection;
1043
1017
 
1044
1018
        if (user->ret_code == FCS_STATE_WAS_SOLVED)
1045
1019
        {
 
1020
            fcs_kv_state_t pass;
 
1021
 
1046
1022
#if (!(defined(HARD_CODED_NUM_FREECELLS) && defined(HARD_CODED_NUM_STACKS) && defined(HARD_CODED_NUM_DECKS)))
1047
1023
            fc_solve_instance_t * instance =
1048
1024
                user->fc_solve_obj;
1049
1025
#endif
 
1026
 
 
1027
            pass.key = &(user->state.s);
 
1028
            pass.val = &(user->state.info);
1050
1029
            /*
1051
1030
             * TODO : maybe only normalize the final moves' stack in
1052
1031
             * order to speed things up.
1053
1032
             * */
1054
1033
            fc_solve_move_stack_normalize(
1055
1034
                &(user->fc_solve_obj->solution_moves),
1056
 
#ifdef FCS_RCS_STATES
1057
 
                &(user->state.s),
1058
 
                &(user->state.info),
1059
 
#else
1060
 
                &(user->state),
1061
 
#endif
1062
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
 
1035
                &(pass),
1063
1036
                &(user->trace_solution_state_locs),
1064
 
#endif
1065
1037
                INSTANCE_FREECELLS_NUM,
1066
1038
                INSTANCE_STACKS_NUM,
1067
1039
                INSTANCE_DECKS_NUM
1068
1040
                );
1069
1041
 
1070
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
1071
1042
            user->trace_solution_state_locs = user->state_locs;
1072
 
#endif
1073
1043
 
1074
1044
            if (instance_item->minimal_solution_flare_idx < 0)
1075
1045
            {
1092
1062
             * and return now.
1093
1063
             * */
1094
1064
            if (((user->current_iterations_limit >= 0) &&
1095
 
                (user->iterations_board_started_at >=
 
1065
                (user->iterations_board_started_at.num_times >=
1096
1066
                    user->current_iterations_limit)) ||
1097
1067
                (user->fc_solve_obj->num_states_in_collection >=
1098
1068
                    user->fc_solve_obj->effective_max_num_states_in_collection)
1099
1069
            )
1100
1070
            {
 
1071
                /* Bug fix:
 
1072
                 * We need to resume from the last flare in case we exceed
 
1073
                 * the board iterations limit.
 
1074
                 * */
 
1075
                instance_item->current_plan_item_idx--;
1101
1076
                break;
1102
1077
            }
1103
1078
 
1143
1118
        {
1144
1119
            int ret;
1145
1120
#ifdef FCS_USE_COMPACT_MOVE_TOKENS
1146
 
            fcs_internal_move_t internal_move;
 
1121
            fcs_internal_move_t internal_move = fc_solve_empty_move;
1147
1122
#endif
1148
1123
 
1149
1124
            ret = fc_solve_move_stack_pop(
1165
1140
 
1166
1141
            if (ret == 0)
1167
1142
            {
 
1143
                fcs_kv_state_t pass;
 
1144
                pass.key = &(user->running_state.s);
 
1145
                pass.val = &(user->running_state.info);
 
1146
 
1168
1147
                fc_solve_apply_move(
1169
 
#ifdef FCS_RCS_STATES
1170
 
                    &(user->running_state.s),
1171
 
                    &(user->running_state.info),
1172
 
#else
1173
 
                    &(user->running_state),
1174
 
#endif
1175
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
 
1148
                    &(pass),
1176
1149
                    NULL,
1177
 
#endif
1178
1150
#ifdef FCS_USE_COMPACT_MOVE_TOKENS
1179
1151
                    internal_move,
1180
1152
#else
1212
1184
 
1213
1185
        return
1214
1186
            fc_solve_state_as_string(
1215
 
#ifdef FCS_RCS_STATES
1216
1187
                &(user->running_state.s),
1217
1188
                &(user->running_state.info),
1218
 
#else
1219
 
                &(user->running_state),
1220
 
#endif
1221
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
1222
1189
                &(user->initial_state_locs),
1223
 
#endif
1224
1190
                INSTANCE_FREECELLS_NUM,
1225
1191
                INSTANCE_STACKS_NUM,
1226
1192
                INSTANCE_DECKS_NUM,
1332
1298
 
1333
1299
    switch (method)
1334
1300
    {
 
1301
        case FCS_METHOD_RANDOM_DFS:
 
1302
        case FCS_METHOD_SOFT_DFS:
 
1303
        case FCS_METHOD_HARD_DFS:
 
1304
        {
 
1305
            user->soft_thread->method_specific.soft_dfs.dfs_max_depth
 
1306
                = user->soft_thread->method_specific.soft_dfs.depth
 
1307
                = user->soft_thread->method_specific.soft_dfs.tests_by_depth_array.num_units
 
1308
                = 0;
 
1309
            user->soft_thread->method_specific.soft_dfs.rand_seed = 24;
 
1310
            user->soft_thread->method_specific.soft_dfs.soft_dfs_info = NULL;
 
1311
            user->soft_thread->method_specific.soft_dfs.tests_by_depth_array.by_depth_units = NULL;
 
1312
        }
 
1313
        break;
1335
1314
        case FCS_METHOD_A_STAR:
1336
1315
        {
1337
1316
            double * my_befs_weights;
1521
1500
 
1522
1501
    user = (fcs_user_t *)api_instance;
1523
1502
 
1524
 
    return user->iterations_board_started_at + user->fc_solve_obj->num_times - user->init_num_times;
 
1503
    return user->iterations_board_started_at.num_times + user->fc_solve_obj->num_times - user->init_num_times.num_times;
1525
1504
}
1526
1505
 
1527
1506
int DLLEXPORT freecell_solver_user_get_limit_iterations(void * api_instance)
1727
1706
 
1728
1707
int DLLEXPORT freecell_solver_user_set_a_star_weight(
1729
1708
    void * api_instance,
1730
 
    int index,
 
1709
    int my_index,
1731
1710
    double weight
1732
1711
    )
1733
1712
{
1736
1715
    user = (fcs_user_t *)api_instance;
1737
1716
 
1738
1717
#define my_befs_weights soft_thread->method_specific.befs.meth.befs.befs_weights
1739
 
    if ((index < 0) || (index >= (sizeof(user->my_befs_weights)/sizeof(user->my_befs_weights[0]))))
 
1718
    if ((my_index < 0) || (my_index >= (sizeof(user->my_befs_weights)/sizeof(user->my_befs_weights[0]))))
1740
1719
    {
1741
1720
        return 1;
1742
1721
    }
1745
1724
        return 2;
1746
1725
    }
1747
1726
 
1748
 
    user->my_befs_weights[index] = weight;
 
1727
    user->my_befs_weights[my_index] = weight;
1749
1728
 
1750
1729
    return 0;
1751
1730
 
1755
1734
#ifdef FCS_COMPILE_DEBUG_FUNCTIONS
1756
1735
double DLLEXPORT fc_solve_user_INTERNAL_get_befs_weight(
1757
1736
    void * api_instance,
1758
 
    int index
 
1737
    int my_index
1759
1738
    )
1760
1739
{
1761
1740
    fcs_user_t * user;
1764
1743
 
1765
1744
#define my_befs_weights soft_thread->method_specific.befs.meth.befs.befs_weights
1766
1745
 
1767
 
    return user->my_befs_weights[index];
 
1746
    return user->my_befs_weights[my_index];
1768
1747
}
1769
1748
 
1770
1749
#endif
1774
1753
    int iter_num,
1775
1754
    int depth,
1776
1755
    void * lp_instance GCC_UNUSED,
1777
 
#ifdef FCS_RCS_STATES
1778
 
    fcs_state_t * ptr_state_key,
1779
 
#endif
1780
 
    fcs_collectible_state_t * ptr_state_val,
 
1756
    fcs_kv_state_t * ptr_state,
1781
1757
    int parent_iter_num
1782
1758
    )
1783
1759
{
1786
1762
 
1787
1763
    user = (fcs_user_t *)api_instance;
1788
1764
 
1789
 
    state_raw.s = ptr_state_val;
1790
 
#ifdef FCS_RCS_STATES
1791
 
    state_raw.key = ptr_state_key;
1792
 
    state_raw.val = ptr_state_val;
1793
 
#endif
1794
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
1795
 
    {
1796
 
        int i;
1797
 
        for ( i=0 ; i<MAX_NUM_STACKS ; i++)
1798
 
        {
1799
 
            state_raw.locs.stack_locs[i] = (fcs_locs_t)i;
1800
 
        }
1801
 
        for ( i=0 ; i<MAX_NUM_FREECELLS ; i++)
1802
 
        {
1803
 
            state_raw.locs.fc_locs[i] = (fcs_locs_t)i;
1804
 
        }
1805
 
    }
1806
 
#endif
1807
 
 
1808
 
#ifdef DEBUG
1809
 
    {
1810
 
        fc_solve_instance_t * instance = user->instance;
1811
 
        HT_LOOP_DECLARE_VARS();
1812
 
 
1813
 
        HT_LOOP_START()
1814
 
        {
1815
 
            ST_LOOP_DECLARE_VARS();
1816
 
 
1817
 
            ST_LOOP_START()
1818
 
            {
1819
 
                if (!strcmp(soft_thread->name, "11"))
1820
 
                {
1821
 
                    double * w =
1822
 
                        soft_thread->method_specific.befs
1823
 
                            .meth.befs.befs_weights
1824
 
                        ;
1825
 
 
1826
 
                    printf("BeFS-Weights[\"11\"]=(%f,%f,%f,%f,%f)\n",
1827
 
                            w[0], w[1], w[2], w[3], w[4]
1828
 
                          );
1829
 
 
1830
 
                    goto myend;
1831
 
                }
1832
 
            }
1833
 
        }
1834
 
 
1835
 
    }
1836
 
myend:
1837
 
#endif
 
1765
    state_raw.key = ptr_state->key;
 
1766
    state_raw.val = ptr_state->val;
 
1767
    fc_solve_init_locs(&(state_raw.locs));
 
1768
 
1838
1769
    user->iter_handler(
1839
1770
        api_instance,
1840
1771
        iter_num,
1841
1772
        depth,
1842
 
        (void *)&state_raw,
 
1773
        (void *)(&state_raw),
1843
1774
        parent_iter_num,
1844
1775
        user->iter_handler_context
1845
1776
        );
1847
1778
    return;
1848
1779
}
1849
1780
 
1850
 
void set_debug_iter_output_func_to_val(
 
1781
static void set_debug_iter_output_func_to_val(
1851
1782
    fcs_user_t * user,
1852
 
        void (*value)(
1853
 
    void * api_instance,
1854
 
    int iter_num,
1855
 
    int depth,
1856
 
    void * lp_instance GCC_UNUSED,
1857
 
#ifdef FCS_RCS_STATES
1858
 
    fcs_state_t * ptr_state_key,
1859
 
#endif
1860
 
    fcs_collectible_state_t * ptr_state_val,
1861
 
    int parent_iter_num
1862
 
    ))
 
1783
    fcs_instance_debug_iter_output_func_t value
 
1784
)
1863
1785
{
1864
1786
    FLARES_LOOP_DECLARE_VARS();
1865
1787
    FLARES_LOOP_START()
1917
1839
 
1918
1840
    return
1919
1841
        fc_solve_state_as_string(
1920
 
#ifdef FCS_RCS_STATES
1921
1842
            ((fcs_standalone_state_ptrs_t *)ptr_state_void)->key,
1922
1843
            ((fcs_standalone_state_ptrs_t *)ptr_state_void)->val,
1923
 
#else
1924
 
            ((fcs_standalone_state_ptrs_t *)ptr_state_void)->s,
1925
 
#endif
1926
 
#ifdef FCS_WITHOUT_LOCS_FIELDS
1927
1844
            &(((fcs_standalone_state_ptrs_t *)ptr_state_void)->locs),
1928
 
#endif
1929
1845
            INSTANCE_FREECELLS_NUM,
1930
1846
            INSTANCE_STACKS_NUM,
1931
1847
            INSTANCE_DECKS_NUM,
1956
1872
 
1957
1873
    user = (fcs_user_t *)api_instance;
1958
1874
 
1959
 
    return user->fc_solve_obj->num_states_in_collection;
 
1875
    return user->iterations_board_started_at.num_states_in_collection + user->fc_solve_obj->num_states_in_collection - user->init_num_times.num_states_in_collection;
1960
1876
}
1961
1877
 
1962
1878
void DLLEXPORT freecell_solver_user_limit_num_states_in_collection(
2190
2106
    {
2191
2107
        recycle_instance(user, i);
2192
2108
    }
 
2109
    /*
 
2110
     * Removing because we are still interested to keep the current iterations
 
2111
     * limit.
 
2112
     * */
 
2113
#if 0
2193
2114
    user->current_iterations_limit = -1;
2194
 
    user->iterations_board_started_at = 0;
 
2115
#endif
 
2116
    user->iterations_board_started_at.num_times = 0;
 
2117
    user->iterations_board_started_at.num_states_in_collection = 0;
2195
2118
    if (user->state_string_copy != NULL)
2196
2119
    {
2197
2120
        free(user->state_string_copy);
2234
2157
}
2235
2158
 
2236
2159
 
2237
 
int DLLEXPORT extern freecell_solver_user_set_pruning(
 
2160
extern int DLLEXPORT freecell_solver_user_set_pruning(
2238
2161
    void * api_instance,
2239
2162
    const char * pruning,
2240
2163
    char * * error_string
2409
2332
    instance =
2410
2333
        user->fc_solve_obj;
2411
2334
 
2412
 
    hard_thread = &(instance->hard_threads[instance->ht_idx]);
 
2335
    hard_thread = instance->current_hard_thread;
2413
2336
 
2414
2337
    return hard_thread->soft_threads[hard_thread->st_idx].name;
2415
2338
}