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: { 8a59754e60 2012-07-14 kinaba: this(const(Game) g) { 8a59754e60 2012-07-14 kinaba: solver = new Solver(g); 8a59754e60 2012-07-14 kinaba: } 8a59754e60 2012-07-14 kinaba: Solver solver; 8a59754e60 2012-07-14 kinaba: bool fin; 8a59754e60 2012-07-14 kinaba: override void on_game_changed(char c, const(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)(); 8a59754e60 2012-07-14 kinaba: auto c = d.addObserver!(CUI!Solver_1)(); 8a59754e60 2012-07-14 kinaba: while(!c.fin) 8a59754e60 2012-07-14 kinaba: d.command(c.solver.single_step()); 9d4aca73fa 2012-07-14 kinaba: }