Differences From Artifact [25b34c42eebd93c9]:
- File
src/cui_auto_main.d
- 2012-07-14 12:29:17 - part of checkin [9d4aca73fa] on branch trunk - GUI+Solver revived. (user: kinaba) [annotate]
To Artifact [a0394f9b9692c1eb]:
- File
src/cui_auto_main.d
- 2012-07-14 12:51:48 - part of checkin [8a59754e60] on branch trunk - GUI auto solver. (user: kinaba) [annotate]
1 import util; 1 import util;
2 import game; 2 import game;
3 import output; 3 import output;
4 import driver; 4 import driver;
5 import solver; 5 import solver;
> 6
> 7 class CUI(Solver) : GameObserver
> 8 {
> 9 this(const(Game) g) {
> 10 solver = new Solver(g);
> 11 }
> 12 Solver solver;
> 13 bool fin;
> 14 override void on_game_changed(char c, const(Game) g, bool finished)
> 15 {
> 16 fin = finished;
> 17 }
> 18 }
6 19
7 void main(string[] args) 20 void main(string[] args)
8 { 21 {
9 Driver d = new Driver(stdin); 22 Driver d = new Driver(stdin);
10 d.addObserver!(GuardedOutput)(); 23 d.addObserver!(GuardedOutput)();
11 Solver s = d.addObserver!(Solver)(); | 24 auto c = d.addObserver!(CUI!Solver_1)();
> 25 while(!c.fin)
12 s.run(&d.command); | 26 d.command(c.solver.single_step());
13 } 27 }