1#!/usr/local/bin/perl 2# /----------------------\ 3# |robot finds kitten say| 4# \---\ /----------------/ 5# / 6# [-] |\_/| 7# (+)=C |o o|__ 8# | | --*--__\ 9# OOO C_C_(___) 10# WHAT YOU SAY? 11# this program makes a robot finding kitten 12# the robot says what you tell it to on the command line 13# you need to escape chars, this program isn't very smart... 14# bad perl code at it's best! 15 16# robot finds kitten 17# http://www.robotfindskitten.org 18# version 0.1 Adam Northern 19# anorthern@redhotlunix.com 20 21$robot[0] = "[-] "; 22$robot[1] = "(+)=C"; 23$robot[2] = "| | "; 24$robot[3] = "OOO "; 25 26$kitten[0] = "|\\_/| "; 27$kitten[1] = "|o o|__ "; 28$kitten[2] = "--*--__\\ "; 29$kitten[3] = "C_C_(___)"; 30 31$whatToSay = join(" ", @ARGV); 32$amountOfChars = length($whatToSay); 33if ($amountOfChars < 7) { 34 $amountOfChars = 7; 35} 36$robotLength = length($robot[0]); 37$kittenLength = length($kitten[0]); 38$lengthBetweenRobotAndKitten = $amountOfChars - ($robotLength + $kittenLength); 39 40$text[0] = ' /'; 41for($i = 0; $i < $amountOfChars; $i++) { 42 $text[0] .= '-'; 43} 44$text[0] .= '\\'; 45 46$text[1] = ' |'; 47$text[1] .= $whatToSay; 48if (length($whatToSay) != $amountOfChars) { 49 for ($i = 0; $i < $amountOfChars-length($whatToSay); $i++) { 50 $text[1] .= " " 51 } 52} 53$text[1] .= '|'; 54 55$text[2] = ' \\---\\ /'; 56for($i = 6; $i < $amountOfChars; $i++) { 57 $text[2] .= '-'; 58} 59$text[2] .= '/'; 60 61$text[3] = ' /'; 62 63for($j = 0; $j < 4; $j++) { 64 $linenum = $j+4; 65 $text[$linenum] = ' ' . $robot[$j]; 66 for($i = 0; $i < $lengthBetweenRobotAndKitten; $i++) { 67 $text[$linenum] .= ' '; 68 } 69 $text[$linenum] .= $kitten[$j]; 70} 71for($i = 0; $i < 8; $i++) { 72 print $text[$i] . "\n"; 73} 74 75