@@ -237,19 +237,19 @@ 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' ); @@ -273,14 +273,14 @@ 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; @@ -320,8 +320,15 @@ 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; } @@ -388,9 +395,9 @@ 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 {