@@ -236,9 +236,9 @@ if(this[y,x] == 'L' || this[y,x] == 'O') return false; return true; } - + Tuple!(int,bool) command(char c, int turn) { assert( this[robot] == 'R' ); if(c=='R') return move( 0, +1, turn); @@ -349,9 +349,9 @@ } } //////////////////////////////////////////////////////////////////////////////// - +/* class Game { mixin DeriveShow; @@ -443,4 +443,377 @@ int hige_until_rise() { return map.hige.until_rise(turn); } int hp() { return map.waterproof - under_water; } } } +*/ + +//////////////////////////////////////////////////////////////////////////////// + +class Game +{ +public: + this(File input) + { + // Read map data + string[] map_data_lines; + for(string line; !(line=input.readln().chomp()).empty; ) + map_data_lines ~= line; + + // H*W + H_ = map_data_lines.length; + W_ = 0; + foreach(mdl; map_data_lines) + W_ = max(W_, mdl.length); + + // Copy to modifiable buffer and adjust coordinates. + raw_data_ = new char[][H_+1]; + foreach(i,mdl; map_data_lines) { + char[] buf = new char[mdl.length+1]; + buf[0] = '#'; + buf[1..$] = mdl[]; + raw_data_[H_-i] = buf; + } + + // Detect objects + for(int y=1; y<=H_; ++y) + for(int x=1; x