示例#1
0
        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));
        }
示例#2
0
 private Solver(FlowBoard board)
 {
     Game = board;
     Game.Reset();
 }