Index: src/solver.d
==================================================================
--- src/solver.d
+++ src/solver.d
@@ -327,10 +327,11 @@
 
 	enum {Tentative, Tentative_Stuck, Fixed};
 	string plan;
 	int    plan_state;
 	int    replan_limit;
+	bool   lambda_getter;
 
 	this(in Game g)
 	{
 		current_game = g.clone();
 		plan         = "";
@@ -355,20 +356,23 @@
 		// Make enough prediction.
 		while( plan_state==Tentative && plan.length<replan_limit )
 			single_step_predict();
 
 		// If the future is bad, correct.
-		if( plan_state==Tentative_Stuck && plan.length<replan_limit )
+		if( plan_state==Tentative_Stuck && plan.length<replan_limit && !lambda_getter )
 			replan();
 
 		// Follow the predicted plan.
 		if( plan.empty )
 			return 'A';
 stderr.writeln(plan, " ", plan_state);
 		char c = plan[0];
 		plan = plan[1..$];
+		int b_lambda = current_game.map.collected_lambda;
 		current_game.command(c);
+		int a_lambda = current_game.map.collected_lambda;
+		if(b_lambda < a_lambda) lambda_getter = false;
 		return c;
 	}
 
 	void force(char c)
 	{
@@ -408,10 +412,11 @@
 	{
 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);
+writeln(cand, " ", cand[0].g.map.collected_lambda);
 		bool tiebreak_by_turn = false;
 		for(int i=0; i<plan.length; ++i) {
 			foreach(string prefix; RandomChoicePattern)
 				if(prefix[0] != plan[i]) {
 					Tuple!(SubSolver, string, int) r = try_plan(g, prefix);
@@ -427,28 +432,29 @@
 							better = true;
 						else if(cand[0].g.map.collected_lambda == r[0].g.map.collected_lambda) {
 							if(cand[0].g.dead && !r[0].g.dead)
 								better = true;
 							else if(cand[0].g.dead == r[0].g.dead) {
-								better = (cand[1].length < r[1].length);
+								better = (cand[1].length < r[1].length && r[2]!=Tentative_Stuck);
 								tbt = true;
 							}
 						}
 					}
 					if(better) {
 						cand = r;
 						tiebreak_by_turn = true;
-writeln(cand);
+writeln(cand, " ", cand[0].g.map.collected_lambda);
 }
 				}
 			g.command(plan[i]);
 		}
 
 		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)
 	{
 		SubSolver s = new SubSolver(g);