```ts
export function liveCount(neighbours: boolean[]): number {
    const numAlive = neighbours.filter(Boolean).length;
    return numAlive === 2 || numAlive === 3 ? 1 : 0;
}

export function liveNext(alive: boolean, neighbours: boolean[]): boolean {
    if (!alive) {
        return neighbours.filter(Boolean).length === 3;
    }
    const aliveNeighbours = neighbours.filter(Boolean).length;
    return aliveNeighbours === 2 || aliveNeighbours === 3;
}
```