Diff
Not logged in

Differences From Artifact [25b34c42eebd93c9]:

To Artifact [a0394f9b9692c1eb]:


1 1 import util; 2 2 import game; 3 3 import output; 4 4 import driver; 5 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 20 void main(string[] args) 8 21 { 9 22 Driver d = new Driver(stdin); 10 23 d.addObserver!(GuardedOutput)(); 11 - Solver s = d.addObserver!(Solver)(); 12 - s.run(&d.command); 24 + auto c = d.addObserver!(CUI!Solver_1)(); 25 + while(!c.fin) 26 + d.command(c.solver.single_step()); 13 27 }