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

Example Usage Not Working #9

Open
SpicyMelonYT opened this issue Jan 25, 2024 · 0 comments
Open

Example Usage Not Working #9

SpicyMelonYT opened this issue Jan 25, 2024 · 0 comments

Comments

@SpicyMelonYT
Copy link

Not really sure what's going on here but the example code doesn't work for me.

I copied over the ndwfc.js file into my project EXACTLY. For brevity I am not going to paste that here.
Also I am running it in a p5js project in the web editor. Here is my sketch.js file code:

function setup() {
  createCanvas(800, 800);

  nd = 2;
  weights = [1, 1, 1];
  rules = [
    ["x", 0, 1],
    ["x", 1, 0],
    ["y", 1, 2],
  ];

  wfc = new WFC({ nd, weights, rules });

  size = 5;
  wfc.expand([-size, -size], [size, size]);
}

function draw() {
  background(51);

  if (frameCount % 100 == 0) {
    var done = wfc.step();

    if (done) {
      size += 5;
      wfc.expand([-size, -size], [size, size]);
    }

    console.log(wfc.readout());
  }
}

When I run it it prints out this:

image

It seems like the issue is coming from the entropy or propogation part of the code as its running into NaNs. But I am confused why if the code I have is pretty much exactly the example code in the home page

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

1 participant