Index: src/game.d ================================================================== --- src/game.d +++ src/game.d @@ -393,35 +393,29 @@ map = g.map.clone(); water = g.water.clone(); turn = g.turn; dead = g.dead; lambda = g.lambda; - exit_bonus = g.exit_bonus; + cleared = g.cleared; under_water = g.under_water; } void command(char c) { + assert(c != 'A'); if(dead || cleared) return; - if(c == 'A') - { - exit_bonus = 1; - return; - } - // TODO: clarify the event order Tuple!(int,bool) ld = map.command(c, turn); if( map.cleared() ) { - exit_bonus = 2; + cleared = true; } else { lambda += ld[0]; - if( ld[1] ) { + if( ld[1] ) dead = true; - } } if( map.robot.y <= water_level ) ++under_water; else under_water = 0; @@ -433,20 +427,18 @@ Map map; Water water; int turn = 0; bool dead = false; int lambda = 0; - int exit_bonus = 0; int under_water = 0; + bool cleared = false; // TODO: when adding members, take care of clone(). // TODO: fix this poor design. @property const { - long score() { return lambda*25L*(1+exit_bonus) - turn; } + long score() { return lambda*(dead ? 25L : cleared ? 75L : 50L) - turn; } int water_level() { return water.level(turn); } int water_until_rise() { return water.until_rise(turn); } int hige_until_rise() { return map.hige.until_rise(turn); } - bool cleared() { return exit_bonus>0; } int hp() { return map.waterproof - under_water; } - long score_if_abort_now() { return lambda*25*(1+max(1,exit_bonus)) - turn; } } } Index: src/output.d ================================================================== --- src/output.d +++ src/output.d @@ -22,11 +22,11 @@ class GuardedOutput : GameObserver { this(in Game g) { setup_sigint_handling(); - ideal_log ~= g.score_if_abort_now; + score_log ~= g.score; flushed = false; } override void on_game_changed(char c, in Game g, bool finished) { @@ -33,40 +33,29 @@ if(flushed) return; log ~= c; score_log ~= g.score; - ideal_log ~= g.score_if_abort_now; if(finished || log.length+1==g.map.W*g.map.H) flush(); } private: string log; long[] score_log; - long[] ideal_log; bool flushed; void flush() { - Tuple!(long, int, int) cand; + Tuple!(long, int) cand; cand[0] = long.min; for(int i=0; i