UNPKG

play-snake

Version:

CLI Snake in a functional style

13 lines (10 loc) 297 B
/** randomInt :: Number → Number → Number */ const randomInt = from => to => Math.floor(Math.random() * to + from) /** randomPoint :: Number → Number → Point */ const randomPoint = cols => rows => ({ x: randomInt(0)(cols), y: randomInt(0)(rows) }) module.exports = { randomPoint }