Differences From Artifact [4176698dd9ba368b]:
- File        
src/solver.d
- 2012-07-15 22:56:00 - part of checkin [9a93aeb664] on branch trunk - Adoptive replanning. (user: kinaba) [annotate]
 
To Artifact [469e63844195a7a0]:
- File        
src/solver.d
- 2012-07-15 22:57:43 - part of checkin [fa2f8e21f2] on branch trunk - messages to stderr. (user: kinaba) [annotate]
 
  345                  // If the future is bad, correct.                                    345                  // If the future is bad, correct.
  346                  if( plan_state==Tentative_Stuck && plan.length<PredictFuture )       346                  if( plan_state==Tentative_Stuck && plan.length<PredictFuture )
  347                          replan();                                                    347                          replan();
  348                                                                                       348  
  349                  // Follow the predicted plan.                                        349                  // Follow the predicted plan.
  350                  if( plan.empty )                                                     350                  if( plan.empty )
  351                          return 'A';                                                  351                          return 'A';
  352  writeln(plan, " ", plan_state);                                                  |   352  stderr.writeln(plan, " ", plan_state);
  353                  char c = plan[0];                                                    353                  char c = plan[0];
  354                  plan = plan[1..$];                                                   354                  plan = plan[1..$];
  355                  current_game.command(c);                                             355                  current_game.command(c);
  356                  return c;                                                            356                  return c;
  357          }                                                                            357          }
  358                                                                                       358  
  359          void force(char c)                                                           359          void force(char c)
................................................................................................................................................................................
  388                          plan_state = (sub_solver.g.dead ? Tentative_Stuck :          388                          plan_state = (sub_solver.g.dead ? Tentative_Stuck :
  389                                        sub_solver.g.cleared ? Fixed : Tentative);     389                                        sub_solver.g.cleared ? Fixed : Tentative);
  390                  }                                                                    390                  }
  391          }                                                                            391          }
  392                                                                                       392  
  393          void replan()                                                                393          void replan()
  394          {                                                                            394          {
  395  writeln("replan!");                                                              |   395  stderr.writeln("replan!");
  396                  // Try to replace every step of the plan by another move.            396                  // Try to replace every step of the plan by another move.
  397                  Game g = current_game.clone();                                       397                  Game g = current_game.clone();
  398                  Tuple!(long, SubSolver, string, int) cand =                          398                  Tuple!(long, SubSolver, string, int) cand =
  399                          tuple(sub_solver.g.score, sub_solver, plan, Tentative_St     399                          tuple(sub_solver.g.score, sub_solver, plan, Tentative_St
  400                  for(int i=0; i<plan.length; ++i) {                                   400                  for(int i=0; i<plan.length; ++i) {
  401                          foreach(string prefix; ["U","D","L","R","UD","DU","LR","     401                          foreach(string prefix; ["U","D","L","R","UD","DU","LR","
  402                                  if(prefix[0] != plan[i]) {                           402                                  if(prefix[0] != plan[i]) {