Diff
Not logged in

Differences From Artifact [1928257cf62dcd18]:

To Artifact [7c15481493257083]:


95 95 96 96 static Map load(string[] raw_data, string[string] params) 97 97 { 98 98 // TODO: choose optimal representation. 99 99 return new Map(raw_data, params); 100 100 } 101 101 102 - private { 103 - char[][] data; 104 - Pos robot; 105 - Pos lift; 106 - int waterproof; 107 - } 102 + char[][] data; 103 + Pos robot; 104 + Pos lift; 105 + int waterproof; 106 + 108 107 Map clone() { return new Map(this); } 109 108 this(Map m) { 110 109 foreach(s; m.data) 111 110 this.data ~= s.dup; 112 111 this.robot = m.robot.clone(); 113 112 this.lift = m.lift.clone(); 114 113 this.waterproof = m.waterproof; ................................................................................ 125 124 this.data[$-1][r.length..$] = ' '; 126 125 } 127 126 128 127 for(int y=1; y<=H; ++y) 129 128 for(int x=1; x<=W; ++x) { 130 129 if(this[y,x] == 'R') 131 130 this.robot = new Pos(y,x); 132 - if(this[y,x] == 'L') 131 + if(this[y,x] == 'L' || this[y,x] == 'O') 133 132 this.lift = new Pos(y,x); 134 133 } 135 134 136 135 this.waterproof = params.get("Waterproof", "5").to!int(); 137 136 } 138 137 139 138 const @property { ................................................................................ 164 163 data[H-1-y][x] = c; 165 164 } 166 165 167 166 void opIndexAssign(char c, Pos p) 168 167 { 169 168 this[p.y, p.x] = c; 170 169 } 170 + 171 + Pos[] lambdas() { 172 + Pos[] ans; 173 + for(int y=1; y<=H; ++y) 174 + for(int x=1; x<=W; ++x) 175 + if(this[y,x] == '\\') 176 + ans ~= new Pos(y,x); 177 + return ans; 178 + } 171 179 172 180 bool cleared() 173 181 { 174 182 for(int y=1; y<=H; ++y) 175 183 for(int x=1; x<=W; ++x) 176 184 if(this[y,x] == 'L' || this[y,x] == 'O') 177 185 return false;