Check-in [bd650eb3f9]
Not logged in
Overview
SHA1 Hash:bd650eb3f90d72a347f4853a0670d7473b820f39
Date: 2012-07-15 20:26:58
User: kinaba
Comment:Output is now fully functional.
Timelines: family | ancestors | descendants | both | trunk
Diffs: redesign
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Modified src/cui_auto_main.d from [80ad58f91e39ad66] to [b38d60ea39d11e6e].

14 fin = finished; 14 fin = finished; 15 } 15 } 16 } 16 } 17 17 18 void main(string[] args) 18 void main(string[] args) 19 { 19 { 20 Driver d = new Driver(stdin); 20 Driver d = new Driver(stdin); 21 // d.addObserver!(GuardedOutput)(); | 21 d.addObserver!(GuardedOutput)(); 22 d.addObserver!(StdOutput)(); < 23 // auto c = d.addObserver!(CUI!MainSolver)(); | 22 auto c = d.addObserver!(CUI!MainSolver)(); 24 auto c = d.addObserver!(CUI!Solver_0)(); < 25 while(!c.fin) 23 while(!c.fin) 26 d.command(c.solver.single_step()); 24 d.command(c.solver.single_step()); 27 } 25 }

Modified src/gui_main.d from [1d7ea5dfabc56eb4] to [372bc7cd7d19e082].

4 import solver; 4 import solver; 5 import std.stdio; 5 import std.stdio; 6 pragma(lib, "dfl.lib"); 6 pragma(lib, "dfl.lib"); 7 7 8 void main(string[] args) 8 void main(string[] args) 9 { 9 { 10 Driver d = new Driver(stdin); 10 Driver d = new Driver(stdin); 11 // d.addObserver!(GuardedOutput)(); | 11 d.addObserver!(GuardedOutput)(); 12 d.addObserver!(StdOutput)(); < 13 // auto g = d.addObserver!(GUI!MainSolver)(); 12 // auto g = d.addObserver!(GUI!MainSolver)(); 14 auto g = d.addObserver!(GUI!Solver_0)(); 13 auto g = d.addObserver!(GUI!Solver_0)(); 15 g.set_fn(&d.command); 14 g.set_fn(&d.command); 16 g.run(); 15 g.run(); 17 } 16 }

Modified src/output.d from [b301f73c74ef62f4] to [e2d0d7db868c3a44].

14 this(in Game g) {} 14 this(in Game g) {} 15 override void on_game_changed(char c, in Game g, bool finished) 15 override void on_game_changed(char c, in Game g, bool finished) 16 { 16 { 17 stdout.write(c); 17 stdout.write(c); 18 stdout.flush(); 18 stdout.flush(); 19 } 19 } 20 } 20 } 21 /* < > 21 22 class GuardedOutput : GameObserver 22 class GuardedOutput : GameObserver 23 { 23 { 24 this(in Game g) 24 this(in Game g) 25 { 25 { 26 setup_sigint_handling(); 26 setup_sigint_handling(); 27 score_log ~= g.score; 27 score_log ~= g.score; 28 flushed = false; 28 flushed = false; ................................................................................................................................................................................ 31 override void on_game_changed(char c, in Game g, bool finished) 31 override void on_game_changed(char c, in Game g, bool finished) 32 { 32 { 33 if(flushed) 33 if(flushed) 34 return; 34 return; 35 35 36 log ~= c; 36 log ~= c; 37 score_log ~= g.score; 37 score_log ~= g.score; 38 if(finished || log.length+1==g.map.W*g.map.H) | 38 if(finished || log.length+1==g.W*g.H) 39 flush(); 39 flush(); 40 } 40 } 41 41 42 private: 42 private: 43 string log; 43 string log; 44 long[] score_log; 44 long[] score_log; 45 bool flushed; 45 bool flushed; ................................................................................................................................................................................ 68 { 68 { 69 assert(g_output is null); 69 assert(g_output is null); 70 g_output = this; 70 g_output = this; 71 extern(C) static void catch_sigint(int) { g_output.flush(); appl 71 extern(C) static void catch_sigint(int) { g_output.flush(); appl 72 core.stdc.signal.signal(SIGINT, &catch_sigint); 72 core.stdc.signal.signal(SIGINT, &catch_sigint); 73 } 73 } 74 } 74 } 75 */ <