Last active
March 13, 2016 04:37
-
-
Save LightSpeedC/f859b50f752f5e2436bf to your computer and use it in GitHub Desktop.
ズンドコキヨシ with JavaScript (Node.js) ref: http://qiita.com/LightSpeedC/items/ac857a0e313275c0cb1a
This file contains 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
// ズンズンズンズンドコキ・ヨ・シ! | |
void function () { | |
'use strict'; | |
var phrase = 'ズンズンズンズンドコ'; | |
var puts = typeof process === 'object' && process && | |
typeof process.stdout === 'object' && process.stdout && | |
typeof process.stdout.write === 'function' ? | |
process.stdout.write.bind(process.stdout) : | |
console.log.bind(console); | |
var generated = ''; | |
do { | |
var choise = ['ズン', 'ドコ'][Math.random() * 2 | 0]; | |
puts(choise); | |
generated = (generated + choise).substr(- phrase.length); | |
} while (generated !== phrase); | |
puts('キ・ヨ・シ!'); | |
}(); |
This file contains 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
$ node zundoko-kiyoshi.js | |
ドコズンズンドコズンズンズンズンズンズンズンズンズンドコキ・ヨ・シ! | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment