import util;
import game;
import output;
import driver;
import solver;

class CUI(Solver) : GameObserver
{
	this(in Game g) { solver = new Solver(g); }
	Solver solver;
	bool fin;
	override void on_game_changed(char c, in Game g, bool finished) { fin = finished; }
}

void main()
{
	auto d = new Driver(stdin);
	d.addObserver!(GuardedOutput)();
	auto c = d.addObserver!(CUI!MainSolver)();
	while(!c.fin)
		d.command(c.solver.single_step());
}
