@jharrilim/game-of-life
Version:
Game of life in CLI
28 lines (21 loc) • 463 B
text/typescript
import { Point } from "./Point";
export class Cell {
private _state: boolean;
private _position: Point;
constructor(x: number, y: number) {
this._state = false;
this._position = { x, y };
}
get position() {
return this._position;
}
get isAlive() {
return this._state;
}
die() {
this._state = false;
}
live() {
this._state = true;
}
}