Differences From Artifact [673d840a0e1a2769]:
- File        
src/solver.d
- 2012-07-14 18:50:00 - part of checkin [faa7422a78] on branch trunk - now the robot can push the rock and turn left/right. (user: kinaba) [annotate]
 
 
To Artifact [cabc7d361baa4f5a]:
- File        
src/solver.d
- 2012-07-15 02:16:47 - part of checkin [34bbd14c1a] on branch trunk - Razor searching. (user: kinaba) [annotate]
 
 
    47     47    Tuple!(Pos, int)[] log;
    48     48    bool[][] forbidden_cell;
    49     49   
    50     50    char act(const(Game) g, string death, int breath)
    51     51    {
    52     52     const Pos   ro = g.map.robot;
    53     53     const Pos[] la = g.map.lambdas();
           54  +  const Pos[] ra = g.map.razors();
    54     55     const Pos   li = g.map.lift;
    55     56   
    56     57     Tuple!(char,int)[] cand;
    57     58     char c = 'W';
    58     59     if( la.empty ) {
    59     60      cand = search(g, ro, [li], death);
    60     61     } else {
    61         -   cand ~= search(g, ro, la, death);
           62  +   cand ~= search(g, ro, la~ra, death);
    62     63     }
    63     64   
    64     65     // 'dig' mode
    65     66     if(cand.empty) {
    66     67      const(Pos)[] tgt;
    67     68      for(int y=1; y<=g.map.H; ++y)
    68     69      for(int x=1; x<=g.map.W; ++x)
................................................................................
   160    161         }
   161    162         if(v[y][x]) continue;
   162    163         if(y==s.y && x==s.x && i<4) {
   163    164          char c = "UDRL"[i];
   164    165          if( death.count(c) == 0 )
   165    166           return [tuple(c,step)];
   166    167         } else if(forbidden_cell[y][x]){
   167         -      } else if(g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||i>=4) {
          168  +      } else if(g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||g.map[y,x]=='!'||i>=4) {
   168    169          if(danger(y,x))
   169    170           continue;
   170    171          q2 ~= new Pos(y,x);
   171    172          v[y][x]=true;
   172    173         }
   173    174        }
   174    175       }
................................................................................
   200    201         }
   201    202         if(v[y][x]) continue;
   202    203         if(y==s.y && x==s.x && i<4) {
   203    204          char c = "UDRL"[i];
   204    205          if( death.count(c) == 0 )
   205    206           return [tuple(c,step)];
   206    207         } else if(forbidden_cell[y][x]){
   207         -      } else if(g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||i>=4) {
          208  +      } else if(g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||g.map[y,x]=='!'||i>=4) {
   208    209          q2 ~= new Pos(y,x);
   209    210          v[y][x]=true;
   210    211         }
   211    212        }
   212    213       }
   213    214       q = q2;
   214    215      }
................................................................................
   243    244         }
   244    245         if(v[y][x]) continue;
   245    246         if(y==s.y && x==s.x && i<4) {
   246    247          char c = "UDRL"[i];
   247    248          if( death.count(c) == 0 )
   248    249           return [tuple(c,step)];
   249    250         } else if(forbidden_cell[y][x]){
   250         -      } else if(g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||g.map[y,x]=='*'||i>=4) {
          251  +      } else if(g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||g.map[y,x]=='*'||g.map[y,x]=='!'||i>=4) {
   251    252          q2 ~= new Pos(y,x);
   252    253          v[y][x]=true;
   253    254         }
   254    255        }
   255    256       }
   256    257       q = q2;
   257    258      }