diff --git a/freecell.cpp b/freecell.cpp
--- a/freecell.cpp
+++ b/freecell.cpp
@@ -40,6 +40,7 @@
#include "dealerinfo.h"
#include "kpat_debug.h"
#include "pileutils.h"
+#include "settings.h"
#include "speeds.h"
#include "patsolve/freecellsolver.h"
@@ -91,7 +92,9 @@
}
setActions(DealerScene::Demo | DealerScene::Hint);
- setSolver( new FreecellSolver( this ) );
+ auto solver = new FreecellSolver( this );
+ solver->default_max_positions = Settings::freecellSolverIterationsLimit();
+ setSolver( solver );
setNeededFutureMoves( 4 ); // reserve some
}
diff --git a/kpat.kcfg b/kpat.kcfg
--- a/kpat.kcfg
+++ b/kpat.kcfg
@@ -32,5 +32,8 @@
1000000
+
+ 200000
+
diff --git a/patsolve/abstract_fc_solve_solver.h b/patsolve/abstract_fc_solve_solver.h
--- a/patsolve/abstract_fc_solve_solver.h
+++ b/patsolve/abstract_fc_solve_solver.h
@@ -44,6 +44,7 @@
/* Names of the cards. The ordering is defined in pat.h. */
void * solver_instance;
+ long default_max_positions;
int solver_ret;
// More than enough space for two decks.
char board_as_string[4 * 13 * 2 * 4 * 3];
diff --git a/patsolve/abstract_fc_solve_solver.cpp b/patsolve/abstract_fc_solve_solver.cpp
--- a/patsolve/abstract_fc_solve_solver.cpp
+++ b/patsolve/abstract_fc_solve_solver.cpp
@@ -24,7 +24,7 @@
#include "abstract_fc_solve_solver.h"
const int CHUNKSIZE = 100;
-const long int MAX_ITERS_LIMIT = 200000;
+const long int INITIAL_MAX_ITERS_LIMIT = 200000;
#define PRINT 0
@@ -51,7 +51,7 @@
SolverInterface::ExitStatus FcSolveSolver::patsolve( int _max_positions )
{
int current_iters_count;
- max_positions = (_max_positions < 0) ? MAX_ITERS_LIMIT : _max_positions;
+ max_positions = (_max_positions < 0) ? default_max_positions : _max_positions;
init();
@@ -110,7 +110,7 @@
current_iters_count = CHUNKSIZE;
set_soft_limit(solver_instance, current_iters_count);
#ifdef WITH_FCS_SOFT_SUSPEND
- freecell_solver_user_limit_iterations(solver_instance, MAX_ITERS_LIMIT);
+ freecell_solver_user_limit_iterations(solver_instance, max_positions);
#endif
}
@@ -121,7 +121,7 @@
( (solver_ret == FCS_STATE_NOT_BEGAN_YET)
|| (solver_ret == SOFT_SUSPEND))
&&
- (current_iters_count < MAX_ITERS_LIMIT)
+ (current_iters_count < max_positions)
)
{
current_iters_count += CHUNKSIZE;
@@ -149,7 +149,7 @@
}
}
const long reached_iters = freecell_solver_user_get_num_times_long(solver_instance);
- Q_ASSERT(reached_iters <= MAX_ITERS_LIMIT);
+ Q_ASSERT(reached_iters <= default_max_positions);
#if 0
fprintf(stderr, "iters = %ld\n", reached_iters);
#endif
@@ -221,6 +221,7 @@
, solver_instance(NULL)
, solver_ret(FCS_STATE_NOT_BEGAN_YET)
, board_as_string("")
+ , default_max_positions(INITIAL_MAX_ITERS_LIMIT)
{
}