@@ -316,22 +316,36 @@ } class Solver_2(SubSolver) : Solver { - static const PredictFuture = 10; + // Parameters. + static const PredictFuture = 10; + const string[] RandomChoicePattern; // PF*RCP exhaustive search for RL steps + const ReplanLength = 400; // O(PF*RCP*RL*SubSolver.single_step) Game current_game; SubSolver sub_solver; enum {Tentative, Tentative_Stuck, Fixed}; string plan; int plan_state; + int replan_limit; this(in Game g) { current_game = g.clone(); plan = ""; plan_state = Tentative; + replan_limit = PredictFuture; + if(g.map.W*g.map.H <= 400) + RandomChoicePattern = ["UU","UD","UL","UR", + "DU","DD","DL","DR", + "LU","LD","LL","LR", + "RU","RD","RL","RR","UUU","UUUU","UUUUU"]; + else if(g.map.W*g.map.H <= 4096) + RandomChoicePattern = ["UUU","U","D","L","R","UD","DU","LR","RL"]; + else + RandomChoicePattern = ["U","D","L","R"]; } char single_step() { @@ -338,13 +352,13 @@ if(current_game.dead || current_game.cleared) return 'A'; // Make enough prediction. - while( plan_state==Tentative && plan.length