Differences From Artifact [da568e3b806540de]:
- File
src/solver.d
- 2012-07-16 08:59:54 - part of checkin [9e34cad783] on branch trunk - One-way road finder. (user: kinaba) [annotate]
To Artifact [97e58dfa28df65c7]:
- File
src/solver.d
- 2012-07-16 10:02:57 - part of checkin [b96971b0b6] on branch trunk - refactoring. (user: kinaba) [annotate]
7 interface Solver 7 interface Solver
8 { 8 {
9 // this(in Game g); 9 // this(in Game g);
10 char single_step(); 10 char single_step();
11 void force(char c); 11 void force(char c);
12 } 12 }
13 13
14 <
15 bool is_spacy(char c) <
16 { <
17 return c==' ' || c=='.' || c=='R' || c=='!' || c=='\\' || c=='O'; <
18 } <
19 <
20 bool is_rocky(char c) <
21 { <
22 return c=='*' || c=='@'; <
23 } <
24 <
25 bool is_true_space(char c) <
26 { <
27 return c==' '; <
28 } <
29 <
30 bool is_trampoline_source(char c) <
31 { <
32 return 'A'<=c && c<='I'; <
33 } <
34 <
35 bool is_rocklambda(char c) <
36 { <
37 return is_rocky(c) || c=='\\'; <
38 } <
39 <
40 Tuple!(string,int) death_move(in Game g) 14 Tuple!(string,int) death_move(in Game g)
41 { 15 {
42 // TODO: S 16 // TODO: S
43 17
44 string death; 18 string death;
45 int breath; 19 int breath;
46 int y = g.map.robot.y; 20 int y = g.map.robot.y;
................................................................................................................................................................................
186 if( g.map.collected_lambda == g.map.total_lambda ) { 160 if( g.map.collected_lambda == g.map.total_lambda ) {
187 cand = search(g, ro, [li], death); 161 cand = search(g, ro, [li], death);
188 } else if( !la.empty ){ 162 } else if( !la.empty ){
189 cand ~= search(g, ro, la~ra, death); 163 cand ~= search(g, ro, la~ra, death);
190 } 164 }
191 165
192 // 'higesori' mode 166 // 'higesori' mode
193 if( !hi.empty && g.map.razor>0 ) { | 167 if( !hi.empty && g.map.num_razor>0 ) {
194 int his = 0; 168 int his = 0;
195 for(int dy=-1; dy<=+1; ++dy) 169 for(int dy=-1; dy<=+1; ++dy)
196 for(int dx=-1; dx<=+1; ++dx) 170 for(int dx=-1; dx<=+1; ++dx)
197 if(g.map[ro.y+dy,ro.x+dx] == 'W') 171 if(g.map[ro.y+dy,ro.x+dx] == 'W')
198 his++; 172 his++;
199 173
200 if(his>=2 || his==hi.length) 174 if(his>=2 || his==hi.length)