Skip to content

Instantly share code, notes, and snippets.

@melcor76
Last active November 16, 2023 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melcor76/e87d69498e28a2417b03090936021b53 to your computer and use it in GitHub Desktop.
Save melcor76/e87d69498e28a2417b03090936021b53 to your computer and use it in GitHub Desktop.
js-tetris - valid
valid(p) {
return p.shape.every((row, dy) => {
return row.every((value, dx) => {
let x = p.x + dx;
let y = p.y + dy;
return (
this.isEmpty(value) ||
(this.insideWalls(x) &&
this.aboveFloor(y))
);
});
});
}
@imorettini
Copy link

it's missing one ) after this.aboveFloor(y)

return ( this.isEmpty(value) || (this.insideWalls(x) && this.aboveFloor(y)) );

@waly2020
Copy link

waly2020 commented Nov 2, 2023

Is not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment