Skip to content

Instantly share code, notes, and snippets.

@shimx
Last active March 11, 2016 13:04
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 shimx/e575cfc410f75774e7be to your computer and use it in GitHub Desktop.
Save shimx/e575cfc410f75774e7be to your computer and use it in GitHub Desktop.
ズンドコキヨシ with Perl ref: http://qiita.com/shimx/items/51da4b56bca1ac2cb269
use strict;
use warnings;
sub kiyoshi {
my @zd = my ($z, $d) = ('ズン', 'ドコ');
my $str = join('', (my @kys = ($z, $z, $z, $z, $d)));
my $cnt = 0;
my @word;
while ( join('', @word) ne $str ) {
shift @word if $#word >= $#kys;
push @word, $zd[rand(@zd)];
print $word[$#word];
$cnt++;
}
print "キ・ヨ・シ!\n($cnt回ズンドコしました)\n";
return;
}
kiyoshi();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment