#!/usr/bin/perl -w # kaguya0x.pl - Don Yang (uguu.org) # # 05/16/09 use strict; use Text::Wrap; # {{{ my @user = qw{ Reimu Marisa Rumia Cirno Meirin Patchouli Sakuya Remilia Flandre Letty Chen Alice Lily Lunasa Marlin Lyrica Youmu Yuyuko Ran Yukari Wriggle Mystia Keine Tewi Udonge Eirin Kaguya Mokou Suika Aya Medicine Yuka Komachi Shikieiki Shizuha Minoriko Hina Nitori Momizi Sanae Kanako Suwako Iku Tenshi Kisume Yamame Parsee Yugi Satori Rin Utsuho Koishi Sunnymilk Lunachild Starsapphire Koakuma Teruyo }; my @text = map {s/^\s*(\S.*)$/$1/ && $1} grep /\S/, split /!/, q{ agreed! Agreed! AGREED! awesome! Awesome! AWESOME! correct! Correct! CORRECT! do it! Do it! DO IT! good idea! Good idea! GOOD IDEA! good job! Good job! GOOD JOB! great! Great! GREAT! great idea! Great idea! i agree! I agree! i second this! I second this! i second that! I second that! it's all good! It's all good! looks good to me! Looks good to me! nice! Nice! NICE! nice going! Nice going! NICE GOING! nice job! Nice job! NICE JOB! ok! Ok! OK! right! Right! RIGHT! ship it! Ship it! SHIP IT! sure! Sure! SURE! totally! Totally! TOTALLY! true dat! True dat! TRUE DAT! wonderful! Wonderful! WONDERFUL! word! Word! WORD! yes! Yes! YES! best thing I have heard! Best thing I have heard! best thing I have seen! Best thing I have seen! best thing since beer! Best thing since beer! best thing since sliced bread! Best thing since sliced bread! best thing since the wheel! Best thing since the wheel! brilliant! Brilliant! BRILLIANT! fabulous! Fabulous! FABULOUS! genius! Genius! GENIUS! marvelous! Marvelous! MARVELOUS! }; # }}} # Load seed text my @seed = <>; # Quote it many times for(my $time = time - 3600; $time < time; $time += int(60 + rand 300)) { # Reply my $firstline = $text[int(rand $#text + 1)]; $firstline .= "!" if rand > 0.5; # Quote header my @quote = ( "$firstline\n", "\n", "On " . scalar(localtime $time) . ", " . $user[int(rand $#user + 1)] . " wrote:\n" ); # Quote text my $current_header = ""; my $quote_header = "> "; my $paragraph = ""; foreach my $line (@seed) { if( $line =~ s/^(>* ?)(.*)$/$2/s ) { if( $1 eq $current_header ) { # Current line is quoted at the same level as the previous # line, added it to current paragraph. $paragraph .= $line; } else { # Flush the current paragraph foreach (split /[\r\n]+/s, wrap($quote_header, $quote_header, $paragraph)) { push @quote, "$_\n"; } # Set new quote header $paragraph = $line; $current_header = $1; $quote_header = ($current_header =~ /^\s*$/ ? "> " : ">$current_header"); } } } # Last paragraph foreach (split /[\r\n]+/s, wrap($quote_header, $quote_header, $paragraph)) { push @quote, "$_\n"; } # Extra blank line at the end push @quote, "\n"; @seed = @quote; } print foreach @seed;