Index: src/game.d ================================================================== --- src/game.d +++ src/game.d @@ -236,21 +236,21 @@ if(this[y,x] == 'L' || this[y,x] == 'O') return false; return true; } - Tuple!(int,bool) command(char c) + Tuple!(int,bool) command(char c, int turn) { - if(c=='R') return move( 0, +1); - if(c=='L') return move( 0, -1); - if(c=='U') return move(+1, 0); - if(c=='D') return move(-1, 0); - if(c=='W') return move( 0, 0); + if(c=='R') return move( 0, +1, turn); + if(c=='L') return move( 0, -1, turn); + if(c=='U') return move(+1, 0, turn); + if(c=='D') return move(-1, 0, turn); + if(c=='W') return move( 0, 0, turn); assert(false); } - Tuple!(int, bool) move(int dy, int dx) + Tuple!(int, bool) move(int dy, int dx, int turn) { int y = robot.y; int x = robot.x; assert( this[robot] == 'R' ); int lambda = 0; @@ -272,16 +272,16 @@ foreach(p; tr_source[this[tp]]) this[p] = ' '; this[tp] = 'R'; robot = tp; } - if( update() ) + if( update(turn) ) dead = true; return tuple(lambda,dead); } - bool update() + bool update(int turn) { bool dead = false; char[][] next; foreach(y,s; data) @@ -319,10 +319,17 @@ } else if(this[p]=='L') { if(!lambda) access(p) = 'O'; } + else if(this[p]=='W') { + if( hige.is_growing_turn(turn) ) + for(int dy=-1; dy<=+1; ++dy) + for(int dx=-1; dx<=+1; ++dx) + if(this[p.y+dy,p.x+dx] == ' ') + access(new Pos(p.y+dy,p.x+dx)) = 'W'; + } } data = next; return dead; } } @@ -387,11 +394,11 @@ exit_bonus = 1; return; } // TODO: clarify the event order - Tuple!(int,bool) ld = map.command(c); + Tuple!(int,bool) ld = map.command(c, turn); if( map.cleared() ) { exit_bonus = 2; } else { lambda += ld[0];