You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Hi Eric,
instance_ is an internal structure that you shouldn't be using in your
code. I've pushed a fix:
commit b4d5b08 (*HEAD -> **master*,
*origin/master*, *origin/HEAD*)
Author: Kevin Greer <[email protected]>
Date: Sun Jul 21 11:22:09 2019 -0400
Fix sweeper demo.
Thanks,
KGR
On Sat, 20 Jul 2019 at 19:28, Eric Dubé ***@***.***> wrote:
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.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2426?email_source=notifications&email_token=ABY5PM2ZINFD5QAYEQYNTD3QAONQXA5CNFSM4IFP7L72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HAOVY2Q>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABY5PM5U3HTZDS7TQININPTQAONQXANCNFSM4IFP7L7Q>
.
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:
I was able to fix the demo by adding the line
cell = cell.obj.instance_;
underneathvar cell = e.src
, as it looks like it'se.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.The text was updated successfully, but these errors were encountered: