Skip to content

Instantly share code, notes, and snippets.

@davidmatas
Created November 16, 2019 16:47
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 davidmatas/a871f04f7393c33f0c7df384f968c38f to your computer and use it in GitHub Desktop.
Save davidmatas/a871f04f7393c33f0c7df384f968c38f to your computer and use it in GitHub Desktop.
import { constructor } from "mocha";
export default class GameOfLive {
}
type Dead = 0
type Alive = 1
type CellStatus = Dead | Alive;
export class Cell {
private status: CellStatus;
constructor(status : CellStatus){
this.status = status
}
getNextStatus( neighbours : number) : CellStatus {
if(this.status === 0) {
if( neighbours === 3) {
return 1;
}
}
if ( neighbours < 2 || neighbours > 3 ) {
return 0
}
return 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment