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

sweeper demo doesn't clear neighbours #2426

Open
KernelDeimos opened this issue Jul 20, 2019 · 1 comment
Open

sweeper demo doesn't clear neighbours #2426

KernelDeimos opened this issue Jul 20, 2019 · 1 comment

Comments

@KernelDeimos
Copy link
Contributor

Hello,

I've been tinkering with the Sweeper demo (com/google/foam/demos/sweeper) and it looks like it does have logic programmed to clear neighbouring squares but it's not working.

Here's the affected logic in Board.js:

    function cellUncovered(e) {
      var cell = e.src;

      if ( cell.mineCount ) return;

      this.setTimeout(
        this.forEachNeighbour.bind(
          this,
          cell,
          function(c) { if ( ! c.mined ) c.covered = false; }),
        32);
    }

I was able to fix the demo by adding the line cell = cell.obj.instance_; underneath var cell = e.src, as it looks like it's e.src.obj.instance_ which has all the properties in it.

I'm new to Foam, so I'm wondering if this is the correct way to solve the problem, and whether it's an error in the demo or if Foam is supposed to be moving properties up to e.src. If this is the correct solution I'd be happy to submit a PR.

@kgrgreer
Copy link
Collaborator

kgrgreer commented Jul 21, 2019 via email

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