Skip to content
This repository was archived by the owner on Apr 26, 2025. It is now read-only.
This repository was archived by the owner on Apr 26, 2025. It is now read-only.

sweeper demo doesn't clear neighbours #2426

@KernelDeimos

Description

@KernelDeimos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions