Index: test.d ================================================================== --- test.d +++ test.d @@ -6,10 +6,11 @@ import dfl.all; class Map { private char[][] data; + bool dead = false; this(File input) { foreach(s; input.byLine()) data ~= s.chomp.dup; @@ -48,11 +49,11 @@ int command_R() { return move(0, +1); } int command_L() { return move(0, -1); } int command_U() { return move(-1, 0); } int command_D() { return move(+1, 0); } - int wait() { update(); return -1; } + int wait() { if(dead)return 0; update(); return -1; } int move(int dy, int dx) { foreach(y,s; data) foreach(x,c; s) if(c == 'R') @@ -60,10 +61,12 @@ assert(false); } int gained = 0; // TODO: atode naosu int move(int dy, int dx, int y, int x) { + if(dead) + return 0; int score = 0; if(data[y+dy][x+dx]=='\\') { score += 25; ++gained; } @@ -91,28 +94,36 @@ bool lambda = false; for(int y=1; y+1=1; --y) for(int x=1; x+1