@jharrilim/game-of-life
Version:
Game of life in CLI
37 lines • 991 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ConsoleMap_1 = require("./ConsoleMap");
exports.ConsoleMap = ConsoleMap_1.ConsoleMap;
const readline_1 = require("readline");
// const lwss = `
// ■■■■
// ■ ■
// ■
// ■ ■
// `.split('');
// lwss.shift();
// TODO: Convert strings like this into Point arrays
function start() {
const app = new ConsoleMap_1.ConsoleMap();
const seed = Number.parseInt(process.argv.pop()) || 30;
app.seed(seed);
app.on('cycle', function (cycleCount) {
app.render();
});
setInterval(() => {
app.cycle();
}, 1000 / 33);
process.on('SIGTERM', () => {
readline_1.clearScreenDown(process.stdout);
process.exit(0);
});
process.on('SIGINT', () => {
readline_1.clearScreenDown(process.stdout);
process.exit(0);
});
}
exports.start = start;
if (require.main === module) {
start();
}
//# sourceMappingURL=index.js.map