Index: src/cui_auto_main.d ================================================================== --- src/cui_auto_main.d +++ src/cui_auto_main.d @@ -16,12 +16,10 @@ } void main(string[] args) { Driver d = new Driver(stdin); -// d.addObserver!(GuardedOutput)(); - d.addObserver!(StdOutput)(); -// auto c = d.addObserver!(CUI!MainSolver)(); - auto c = d.addObserver!(CUI!Solver_0)(); + d.addObserver!(GuardedOutput)(); + auto c = d.addObserver!(CUI!MainSolver)(); while(!c.fin) d.command(c.solver.single_step()); } Index: src/gui_main.d ================================================================== --- src/gui_main.d +++ src/gui_main.d @@ -6,12 +6,11 @@ pragma(lib, "dfl.lib"); void main(string[] args) { Driver d = new Driver(stdin); -// d.addObserver!(GuardedOutput)(); - d.addObserver!(StdOutput)(); + d.addObserver!(GuardedOutput)(); // auto g = d.addObserver!(GUI!MainSolver)(); auto g = d.addObserver!(GUI!Solver_0)(); g.set_fn(&d.command); g.run(); } Index: src/output.d ================================================================== --- src/output.d +++ src/output.d @@ -16,11 +16,11 @@ { stdout.write(c); stdout.flush(); } } -/* + class GuardedOutput : GameObserver { this(in Game g) { setup_sigint_handling(); @@ -33,11 +33,11 @@ if(flushed) return; log ~= c; score_log ~= g.score; - if(finished || log.length+1==g.map.W*g.map.H) + if(finished || log.length+1==g.W*g.H) flush(); } private: string log; @@ -70,6 +70,5 @@ g_output = this; extern(C) static void catch_sigint(int) { g_output.flush(); application_exit(); } core.stdc.signal.signal(SIGINT, &catch_sigint); } } -*/