UNPKG

game-of-life-d3-boots

Version:

conway's game of life with a small bit of interactivity. an observer can click on a square to "infect" it (turn its living color to red). then, whenever that cell is live, it will "infect" its living neighbors

21 lines (19 loc) 460 B
/** * Uniformly samples a random element from an Array. * @function randomElement * @param {Array} array * @return {*} */ module.exports.randomElement = function randomElement(array) { return array[Math.floor(Math.random() * array.length)]; }; /** * Checks whether a value is null or undefined. * @function isNully * @param {*} value * @return {Boolean} */ function isNully(value) { return value == null; } module.exports.isNully = isNully;