1234567891011121314151617181920212223 |
- class Cell {
- constructor(x, y, m) {
- this.x = x;
- this.y = y;
- this.hasMine = m;
- this.revealed = false;
- this.flagged = false;
- this.weight = -1;
- this.neighbors = null;
- }
-
- reveal () {
- if (this.flagged) return;
-
- this.revealed = true;
- }
-
- toggleFlag () {
- if (this.revealed) return;
-
- this.flagged = !this.flagged;
- }
- }
|