Differences From Artifact [09842c914b3d99f0]:
- File
src/game.d
- 2012-07-15 02:11:16 - part of checkin [3a08e528e7] on branch trunk - Using razor. (user: kinaba) [annotate]
To Artifact [5d6b45c159e125db]:
- File
src/game.d
- 2012-07-15 02:16:47 - part of checkin [34bbd14c1a] on branch trunk - Razor searching. (user: kinaba) [annotate]
216 } 216 }
217 217
218 void opIndexAssign(char c, in Pos p) 218 void opIndexAssign(char c, in Pos p)
219 { 219 {
220 this[p.y, p.x] = c; 220 this[p.y, p.x] = c;
221 } 221 }
222 222
223 Pos[] lambdas() const { | 223 Pos[] objects(char c) const {
224 Pos[] ans; 224 Pos[] ans;
225 for(int y=1; y<=H; ++y) 225 for(int y=1; y<=H; ++y)
226 for(int x=1; x<=W; ++x) 226 for(int x=1; x<=W; ++x)
227 if(this[y,x] == '\\') | 227 if(this[y,x] == c)
228 ans ~= new Pos(y,x); 228 ans ~= new Pos(y,x);
229 return ans; 229 return ans;
230 } 230 }
231 231
> 232 Pos[] razors() const { return objects('!'); }
> 233 Pos[] lambdas() const { return objects('\\'); }
> 234
232 bool cleared() const 235 bool cleared() const
233 { 236 {
234 for(int y=1; y<=H; ++y) 237 for(int y=1; y<=H; ++y)
235 for(int x=1; x<=W; ++x) 238 for(int x=1; x<=W; ++x)
236 if(this[y,x] == 'L' || this[y,x] == 'O') 239 if(this[y,x] == 'L' || this[y,x] == 'O')
237 return false; 240 return false;
238 return true; 241 return true;