Created
November 16, 2019 16:47
-
-
Save davidmatas/a871f04f7393c33f0c7df384f968c38f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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