@@ -317,9 +317,9 @@ class Solver_2(SubSolver) : Solver { // Parameters. - static const PredictFuture = 10; + int 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; @@ -329,8 +329,9 @@ string plan; int plan_state; int replan_limit; bool lambda_getter; + int clear_improvement = 3; this(in Game g) { current_game = g.clone(); @@ -345,8 +346,13 @@ 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"]; + + if(g.map.W*g.map.H <= 400) + PredictFuture = 20; + else + PredictFuture = 10; } char single_step() { @@ -413,8 +419,9 @@ stderr.writeln("replan!"); // Try to replace every step of the plan by another move. Game g = current_game.clone(); Tuple!(SubSolver, string, int) cand = tuple(sub_solver, plan, Tentative_Stuck); + int insertion_point = plan.length; writeln(cand, " ", cand[0].g.map.collected_lambda); bool tiebreak_by_turn = false; for(int i=0; i0) { + sub_solver = cand[0]; + plan = cand[1]; + plan_state = Tentative_Stuck; + replan_limit = (plan.length - insertion_point); + lambda_getter = current_game.map.collected_lambda < cand[0].g.map.collected_lambda; + } else { + sub_solver = cand[0]; + plan = cand[1]; + plan_state = (plan.length < PredictFuture ? Fixed : cand[2]); + replan_limit = tiebreak_by_turn ? min(PredictFuture, plan.length/2) : PredictFuture; + lambda_getter = current_game.map.collected_lambda < cand[0].g.map.collected_lambda; + } } Tuple!(SubSolver, string, int) try_plan(in Game g, string prefix) {