@@ -98,14 +98,13 @@ // TODO: choose optimal representation. return new Map(raw_data, params); } - private { - char[][] data; - Pos robot; - Pos lift; - int waterproof; - } + char[][] data; + Pos robot; + Pos lift; + int waterproof; + Map clone() { return new Map(this); } this(Map m) { foreach(s; m.data) this.data ~= s.dup; @@ -128,9 +127,9 @@ for(int y=1; y<=H; ++y) for(int x=1; x<=W; ++x) { if(this[y,x] == 'R') this.robot = new Pos(y,x); - if(this[y,x] == 'L') + if(this[y,x] == 'L' || this[y,x] == 'O') this.lift = new Pos(y,x); } this.waterproof = params.get("Waterproof", "5").to!int(); @@ -167,8 +166,17 @@ void opIndexAssign(char c, Pos p) { this[p.y, p.x] = c; } + + Pos[] lambdas() { + Pos[] ans; + for(int y=1; y<=H; ++y) + for(int x=1; x<=W; ++x) + if(this[y,x] == '\\') + ans ~= new Pos(y,x); + return ans; + } bool cleared() { for(int y=1; y<=H; ++y)