Fix erroneous trigger for first mine move
This commit is contained in:
parent
4feb43786b
commit
18d17cbe3b
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minesweeper",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.9",
|
||||
"description": "Just Minesweeper!",
|
||||
"author": "Felix W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
|
|
@ -517,12 +517,12 @@ class Field {
|
|||
onUncover(square) {
|
||||
if (!this.started && square.hasMine) {
|
||||
square.hasMine = false;
|
||||
this.squareList
|
||||
.filter(it => it.hasMine && it !== square)[0]
|
||||
.hasMine = true;
|
||||
|
||||
this.started = true;
|
||||
const target = this.squareList
|
||||
.filter(it => it.hasMine && it !== square)[0];
|
||||
target.hasMine = true;
|
||||
log(`Moved mine from (${square.x}, ${square.y}) to (${target.x}, ${target.y}).`)
|
||||
}
|
||||
this.started = true;
|
||||
|
||||
if (!square.hasMine) {
|
||||
this.coveredRemaining = this.squareList.filter(it => !it.hasMine && it.isCovered).length;
|
||||
|
|
Loading…
Reference in New Issue