Differences From Artifact [d3f73764386d7688]:
- File
src/cui_auto_main.d
- 2012-07-14 14:22:32 - part of checkin [a0c3529225] on branch trunk - code cleanup (user: kinaba) [annotate]
To Artifact [8844bb07a00188c5]:
- File
src/cui_auto_main.d
- 2012-07-14 14:33:25 - part of checkin [aea6cfc7e3] on branch trunk - further 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, const(Game) g, bool finished) | 12 override void on_game_changed(char c, in Game g, bool finished)
13 { 13 {
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 auto c = d.addObserver!(CUI!Solver_1)(); 22 auto c = d.addObserver!(CUI!Solver_1)();
23 while(!c.fin) 23 while(!c.fin)
24 d.command(c.solver.single_step()); 24 d.command(c.solver.single_step());
25 } 25 }