9d4aca73fa 2012-07-14 kinaba: import util; 9d4aca73fa 2012-07-14 kinaba: import game; 9d4aca73fa 2012-07-14 kinaba: import output; 9d4aca73fa 2012-07-14 kinaba: import driver; 9d4aca73fa 2012-07-14 kinaba: import solver; 9d4aca73fa 2012-07-14 kinaba: 8a59754e60 2012-07-14 kinaba: class CUI(Solver) : GameObserver 8a59754e60 2012-07-14 kinaba: { a0c3529225 2012-07-14 kinaba: this(in Game g) { solver = new Solver(g); } 8a59754e60 2012-07-14 kinaba: Solver solver; 8a59754e60 2012-07-14 kinaba: bool fin; aea6cfc7e3 2012-07-14 kinaba: override void on_game_changed(char c, in Game g, bool finished) 8a59754e60 2012-07-14 kinaba: { 8a59754e60 2012-07-14 kinaba: fin = finished; 8a59754e60 2012-07-14 kinaba: } 8a59754e60 2012-07-14 kinaba: } 8a59754e60 2012-07-14 kinaba: 9d4aca73fa 2012-07-14 kinaba: void main(string[] args) 9d4aca73fa 2012-07-14 kinaba: { 9d4aca73fa 2012-07-14 kinaba: Driver d = new Driver(stdin); 9d4aca73fa 2012-07-14 kinaba: d.addObserver!(GuardedOutput)(); fec7ddc502 2012-07-14 kinaba: auto c = d.addObserver!(CUI!MainSolver)(); 8a59754e60 2012-07-14 kinaba: while(!c.fin) 8a59754e60 2012-07-14 kinaba: d.command(c.solver.single_step()); 9d4aca73fa 2012-07-14 kinaba: }