Last active
March 11, 2016 13:04
-
-
Save shimx/e575cfc410f75774e7be to your computer and use it in GitHub Desktop.
ズンドコキヨシ with Perl ref: http://qiita.com/shimx/items/51da4b56bca1ac2cb269
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
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