Jeu de démineur sur navigateur avec p5.js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cell.js 344B

1234567891011121314151617181920212223
  1. class Cell {
  2. constructor(x, y, m) {
  3. this.x = x;
  4. this.y = y;
  5. this.hasMine = m;
  6. this.revealed = false;
  7. this.flagged = false;
  8. this.weight = -1;
  9. this.neighbors = null;
  10. }
  11. reveal () {
  12. if (this.flagged) return;
  13. this.revealed = true;
  14. }
  15. toggleFlag () {
  16. if (this.revealed) return;
  17. this.flagged = !this.flagged;
  18. }
  19. }