Skip to content

Instantly share code, notes, and snippets.

@LightSpeedC
Last active March 13, 2016 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LightSpeedC/f859b50f752f5e2436bf to your computer and use it in GitHub Desktop.
Save LightSpeedC/f859b50f752f5e2436bf to your computer and use it in GitHub Desktop.
ズンドコキヨシ with JavaScript (Node.js) ref: http://qiita.com/LightSpeedC/items/ac857a0e313275c0cb1a
// ズンズンズンズンドコキ・ヨ・シ!
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('キ・ヨ・シ!');
}();
$ node zundoko-kiyoshi.js
ドコズンズンドコズンズンズンズンズンズンズンズンズンドコキ・ヨ・シ!
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment