#!/usr/bin/perl
# /----------------------\
# |robot finds kitten say|
# \---\ /----------------/
#     /
# [-]            |\_/|
# (+)=C          |o o|__
# | |            --*--__\
# OOO            C_C_(___)
# WHAT YOU SAY?
# this program makes a robot finding kitten
# the robot says what you tell it to on the command line
# you need to escape chars, this program isn't very smart...
# bad perl code at it's best!

# robot finds kitten
# http://www.robotfindskitten.org
# version 0.1 Adam Northern
# anorthern@redhotlunix.com

$robot[0] = "[-]  ";
$robot[1] = "(+)=C";
$robot[2] = "| |  ";
$robot[3] = "OOO  ";

$kitten[0] = "|\\_/|    ";
$kitten[1] = "|o o|__  ";
$kitten[2] = "--*--__\\ ";
$kitten[3] = "C_C_(___)";

$whatToSay = join(" ", @ARGV);
$amountOfChars = length($whatToSay);
if ($amountOfChars < 7) {
	$amountOfChars = 7;
}
$robotLength   = length($robot[0]);
$kittenLength  = length($kitten[0]);
$lengthBetweenRobotAndKitten = $amountOfChars - ($robotLength + $kittenLength);

$text[0] = ' /';
for($i = 0; $i < $amountOfChars; $i++) {
	$text[0] .= '-';
}
$text[0] .= '\\';

$text[1]  = ' |';
$text[1] .= $whatToSay;
if (length($whatToSay) != $amountOfChars) {
	for ($i = 0; $i < $amountOfChars-length($whatToSay); $i++) {
		$text[1] .= " "
	}
} 
$text[1] .= '|';

$text[2] = ' \\---\\ /';
for($i = 6; $i < $amountOfChars; $i++) {
	$text[2] .= '-';
}
$text[2] .= '/';

$text[3] = '     /';

for($j = 0; $j < 4; $j++) {
	$linenum = $j+4;
	$text[$linenum] = ' ' . $robot[$j];
	for($i = 0; $i < $lengthBetweenRobotAndKitten; $i++) {
		$text[$linenum] .= ' ';
	}
	$text[$linenum] .= $kitten[$j];
}
for($i = 0; $i < 8; $i++) {
	print $text[$i] . "\n";
}

