Last active
November 10, 2016 09:37
-
-
Save nipotan/3290bd5a98129875a8507db2583af763 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 perl | |
use strict; | |
use warnings; | |
use utf8; | |
{ | |
binmode STDOUT, ':utf8'; | |
local $| = 1; | |
my @words = ( | |
['君'], | |
['に', 'の', 'と'], | |
['桜', ''], | |
['ハート', 'コト', 'トナリ', 'ネガイ', 'ヒラリ', 'ミライ', 'オモイ'], | |
['に', 'で', 'と'], | |
[ | |
'解き放つ', '守りたい', '踊りたい', | |
'作りたい', '叶えたい', '届けたい', '舞う', | |
], | |
['!', ''], | |
); | |
my @correct = ( | |
'君のハートに解き放つ!', '君のコト守りたい!', | |
'君のトナリで踊りたい!', '君のネガイ叶えたい!', | |
'君に桜ヒラリと舞う', '君とミライ作りたい!', '君のオモイ届けたい', | |
); | |
my %correct = map { $_ => 1 } @correct; | |
my $count = 0; | |
while (1) { | |
++$count; | |
my @result = (); | |
for my $parts (@words) { | |
push @result, $parts->[rand(scalar @$parts)]; | |
} | |
my $result = join '', @result; | |
print $result, "\n"; | |
last if $correct{$result}; | |
} | |
printf "私たち %d 回目でも君の味方だよ Doll☆Elements です\n", $count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment