Differences From Artifact [b38d60ea39d11e6e]:
- File
src/cui_auto_main.d
- 2012-07-14 16:39:50 - part of checkin [fec7ddc502] on branch trunk - Refactoring for ease of changine main solver. (user: kinaba) [annotate]
- 2012-07-15 11:26:58 - part of checkin [bd650eb3f9] on branch trunk - Output is now fully functional. (user: kinaba) [annotate]
To Artifact [f6cab5c23c5cba1e]:
- File
src/main.d
- 2012-07-15 13:27:45 - part of checkin [3014ab5a8a] on branch trunk - Clean up. (user: kinaba) [annotate]
5 import solver; 5 import solver;
6 6
7 class CUI(Solver) : GameObserver 7 class CUI(Solver) : GameObserver
8 { 8 {
9 this(in Game g) { solver = new Solver(g); } 9 this(in Game g) { solver = new Solver(g); }
10 Solver solver; 10 Solver solver;
11 bool fin; 11 bool fin;
12 override void on_game_changed(char c, in Game g, bool finished) | 12 override void on_game_changed(char c, in Game g, bool finished) { fin =
13 { <
14 fin = finished; <
15 } <
16 } 13 }
17 14
18 void main(string[] args) | 15 void main()
19 { 16 {
20 Driver d = new Driver(stdin); | 17 auto d = new Driver(stdin);
21 d.addObserver!(GuardedOutput)(); 18 d.addObserver!(GuardedOutput)();
22 auto c = d.addObserver!(CUI!MainSolver)(); 19 auto c = d.addObserver!(CUI!MainSolver)();
23 while(!c.fin) 20 while(!c.fin)
24 d.command(c.solver.single_step()); 21 d.command(c.solver.single_step());
25 } 22 }