public static Task <bool> Solve(FlowBoard board, CancellationToken ct) { return(Task.Run(() => { var solver = new Solver(board) { Token = ct }; List <Node> nodes = solver.InitializeNodes(); solver.SearchForcedPaths(nodes); bool foundPaths = solver.Search(nodes); if (!foundPaths) { board.Reset(); } return foundPaths; }, ct)); }
private Solver(FlowBoard board) { Game = board; Game.Reset(); }