Created
October 15, 2014 19:57
-
-
Save bwinton/2063ef4ea0fa9fb9c977 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env node | |
var suncalc = require('suncalc'); | |
var phase = suncalc.getMoonIllumination(new Date()).phase; | |
var phases = [ | |
"π", | |
"π", | |
"π", | |
"π", | |
"π", | |
"π", | |
"π", | |
"π", | |
"π", | |
"π" | |
]; | |
stepPhase = function (phase) { | |
var rv = Math.round(phase * 8) % 8; | |
if (Math.random() <= 0.1 && rv === 0) { | |
rv = 8; | |
} else if (Math.random() <= 0.1 && rv === 4) { | |
rv = 9; | |
} | |
return rv; | |
} | |
console.log(phases[stepPhase(phase)]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment