Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deque is empty #21

Open
Sajdkick opened this issue Jul 27, 2021 · 4 comments
Open

Deque is empty #21

Sajdkick opened this issue Jul 27, 2021 · 4 comments

Comments

@Sajdkick
Copy link

I sometimes get the exception
System.Exception: Deque is empty at DeBroglie.Wfc.WavePropagator.Step() at DeBroglie.Wfc.WavePropagator.Run() at DeBroglie.TilePropagator.Run()

This is on an AdjecentModel with one CountConstraint and a manual Select() to insert '0' tiles on the border. It's pretty rare though, have happened twice over 2 hours of playing around.

@BorisTheBrave
Copy link
Owner

That sounds like it needs fixing, but I don't think I can proceed without a test case. (note you can fix the random seed to get reproducible results).

@Sajdkick
Copy link
Author

Awesome, when it shows up again I'll try to get a test case for you :)

@Sajdkick
Copy link
Author

Sajdkick commented Aug 12, 2021

I got it to happen consistently.

DeBroglie.Tiled.TiledMapImporter importer = new DeBroglie.Tiled.TiledMapImporter();

var sampleSet = importer.Load("Deque Map Crash");

// Specify the model used for generation
var model = new OverlappingModel(2, 2, sampleSet.Samples[0].Topology.Depth == 1 ? 1 : 2);

model.AddSample(sampleSet.Samples[0]);

// Set the output dimensions
var topology = new GridTopology(10, 10, sampleSet.Samples[0].Topology.Depth, false);

Random random = new Random(0);

var options = new TilePropagatorOptions
{
    Constraints = new[] { new DeBroglie.Constraints.CountConstraint
    {
        Tiles = new[] { new Tile(129) }.ToHashSet(),
        Count = 5,
        Comparison = DeBroglie.Constraints.CountComparison.Exactly,
        Eager = false,
    } },
    BackTrackDepth = 1000,
    RandomDouble = () => { return random.NextDouble(); }
};

// Acturally run the algorithm
var propagator = new TilePropagator(model, topology, options);
propagator.Run();

If I run this while loading this json map https://pastebin.com/CBhymARK i get the error everytime.

@BorisTheBrave
Copy link
Owner

Unfortunately, this isn't reproducing anytning for me. I've tried many seeds, and there are no issues.

Are you using the latest version, read from the master branch?

Otherwise, I'm afraid you may need to try again with a nother random generator (.e.g https://gist.github.com/kaustav-das/cf6b60638e62abb0394737f19f2fcf03)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants