Check-in [2f2eff2f03]
Not logged in
Overview
SHA1 Hash:2f2eff2f0353127d4a0ea3455748e05cf600d3d9
Date: 2012-07-15 03:26:12
User: kinaba
Comment:fall rock mode.
Timelines: family | ancestors | descendants | both | trunk
Diffs: redesign
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Modified src/solver.d from [4aac390deb513002] to [01f7e924127970bf].

33 foreach(char c; "UDLRW") { 33 foreach(char c; "UDLRW") { 34 Game gg = g.clone(); 34 Game gg = g.clone(); 35 gg.command(c); 35 gg.command(c); 36 if( !gg.cleared && gg.dead ) 36 if( !gg.cleared && gg.dead ) 37 death ~= c; 37 death ~= c; 38 else if( gg.map.robot != g.map.robot ) 38 else if( gg.map.robot != g.map.robot ) 39 choice++; 39 choice++; > 40 else if( c != 'W' ) // meaningless move > 41 death ~= c; 40 } 42 } 41 return tuple(death, choice); 43 return tuple(death, choice); 42 } 44 } 43 45 44 Tuple!(Pos, int)[] log; 46 Tuple!(Pos, int)[] log; 45 bool[][] forbidden_cell; 47 bool[][] forbidden_cell; 46 48 ................................................................................................................................................................................ 53 Tuple!(char,int)[] cand; 55 Tuple!(char,int)[] cand; 54 char c = 'W'; 56 char c = 'W'; 55 if( la.empty ) { 57 if( la.empty ) { 56 cand = search(g, ro, [li], death); 58 cand = search(g, ro, [li], death); 57 } else { 59 } else { 58 cand ~= search(g, ro, la, death); 60 cand ~= search(g, ro, la, death); 59 } 61 } > 62 > 63 // 'dig' mode 60 if(cand.empty) { 64 if(cand.empty) { 61 const(Pos)[] tgt; 65 const(Pos)[] tgt; 62 for(int y=1; y<=g.map.H; ++y) 66 for(int y=1; y<=g.map.H; ++y) 63 for(int x=1; x<=g.map.W; ++x) 67 for(int x=1; x<=g.map.W; ++x) 64 if(g.map[y,x]=='.') 68 if(g.map[y,x]=='.') 65 if(g.map[y+1,x]=='*'||g.map[y+1,x-1]=='* 69 if(g.map[y+1,x]=='*'||g.map[y+1,x-1]=='* 66 ||g.map[y,x+1]=='*'||g.map[y,x-1]=='*') 70 ||g.map[y,x+1]=='*'||g.map[y,x-1]=='*') ................................................................................................................................................................................ 73 sort!((Tuple!(char,int) c1, Tuple!(char,int) c2){ 77 sort!((Tuple!(char,int) c1, Tuple!(char,int) c2){ 74 if(c1[1] != c2[1]) 78 if(c1[1] != c2[1]) 75 return c1[1] < c2[1]; 79 return c1[1] < c2[1]; 76 return c1[0] < c2[0]; 80 return c1[0] < c2[0]; 77 })(cand); 81 })(cand); 78 c = cand[0][0]; 82 c = cand[0][0]; 79 83 80 if(death.count(c)) { | 84 if(death.count(c) || wait_count>=2) { 81 foreach(char live; "UDLRWA") | 85 foreach(char live; "UDLRW") 82 if(death.count(live)==0) { 86 if(death.count(live)==0) { 83 c=live; 87 c=live; 84 break; 88 break; 85 } 89 } 86 } 90 } 87 91 88 if(c=='W') { 92 if(c=='W') {