Some brilliant golfing from Mtv Europe and Ronald J Kimball has
allowed me to increase the number of camels from 32 to 128.
There are now seven options:
perl camel.pl normal camel
perl camel.pl q quine (program prints itself)
perl camel.pl m mirror (camel looking in the mirror)
perl camel.pl i inverted camel
perl camel.pl u upside-down camel
perl camel.pl r rotated camel
perl camel.pl h horizontally-squashed camel
perl camel.pl v vertically-squashed camel
The above options can be combined, for example:
perl camel.pl hv small camel
Here is the new generator program, gencamel.pl:
use Acme::EyeDrops qw(sightly);
my $src = <<'END_SRC_STR';
$~=uc pop;open$%;chop(@~=<0>);$~=~R&&(@~=map{$-=$_+$_;
join'',map/.{$-}(.)/,@~}$%..33);$|--&$~=~H&&next,
$~!~Q&&y,!-~,#,,$~=~I&&y~ #~# ~,$~=~M&&($_=reverse),
print$~=~V?/(.).?/g:$_,$/for$~=~U?reverse@~:@~
END_SRC_STR
$src =~ tr/\n//d;
my $prog = sightly( { Regex => 1,
Shape => 'camel',
SourceString => $src } );
my @a = split(/\n/, $prog);
my $max = 0; length > $max and $max = length for @a;
$_ .= ' ' x ($max - length) for @a; $\ = "\n";
print ' ' x ($max+2); print " $_ " for @a; print ' ' x ($max+2);
You can create camel.pl (shown below) with:
perl gencamel.pl >camel.pl
As always, any golfing improvements to:
$~=uc pop;open$%;chop(@~=<0>);$~=~R&&(@~=map{$-=$_+$_;
join'',map/.{$-}(.)/,@~}$%..33);$|--&$~=~H&&next,
$~!~Q&&y,!-~,#,,$~=~I&&y~ #~# ~,$~=~M&&($_=reverse),
print$~=~V?/(.).?/g:$_,$/for$~=~U?reverse@~:@~
are most welcome.
Enjoy,
/-\ndrew
camel.pl:
(Save all text between ----- lines below, including
leading and trailing space-filled lines)
--------------------------------------------------------------------
''=~('('.'?'
.'{'.( '`'|'%').("\["^
'-').('`'| '!').('`'|',').'"'
.'\\'.'$'. ('~'). '='.('['^'.').("\`"|
'#').('{'^'[').('['^ '+').('`'|'/').(('[')^
'+').';'.('`'|"\/").( '['^'+').('`'|'%').('`'
|'.').'\\'.'$'.'%'. ';'.('`'|'#').('`'|"\(").(
'`'|'/').('['^ '+').'('.'\\'.'@'.'~'.'='.'<'
.('^'^('`'|'.' )).'>'.')'.';'.'\\'.'$'.'~'.'='.
'~'.('{'^"\)"). '&'.'&'.'('.'\\'.'@'.'~'.'='.("\`"|
'-').('`'|'!'). ('['^'+').'\\'.'{'.'\\'.'$'.'-'.('=').
'\\'.'$'.('_'). '+'.'\\'.'$'.'_'.';'.('`'|'*').('`'|'/')
.('`'|(')')).( '`'|'.')."'"."'".','.('`'|'-').('`'|'!').
('['^'+').'/'. '.'.'\\'.'{'.'\\'.'$'.'-'.'\\'.'}'.'('.'.'
.')'.'/'.','.'\\'.'@'.'~'.'\\'.'}'.'\\'.'$'.'%'.'.'."\.".(
'^'^('`'|'-')).('^'^('`'|'-')).')'.';'.'\\'.'$'.'|'.'-'.'-'
.'&'.'\\'.'$'.'~'.'='.'~'.('`'^'(').'&'.'&'.('`'|'.').('`'
|'%').('['^'#').('['^'/').','.'\\'.'$'.'~'.'!'.'~'.('{'^'*'
).'&'.'&'.('['^'"').','.'!'.'-'.'~'.','.'#'.','.','.('\\').
'$'.'~'.'='.'~'.('`'^')').'&'.'&'.('['^'"').'~'.('{'^'[').
'#'.'~'.'#'.('{'^'[').'~'.','.'\\'.'$'.'~'.'='."\~".( '`'
^'-').'&'.'&'.'('.'\\'.'$'.'_'.'='.('['^')').("\`"| '%'
).('['^'-').('`'|'%').('['^')').('['^'(') .(('`')| '%'
).')'.','.('['^'+').('['^')').('`'|')' ).('`'| '.'
).''. ('['^'/').'\\'.'$'.'~'.'='.'~' .("\{"^ '-'
).'?'.'/'.'('.'.'.')'.'.'.'?' ."\/".( '`'
|("'")). "\:".'\\'. ('$'). ('_'). ((
"\,")). '\\'.'$' .'/'.( ('`')| ((
'&'))). ('`'|'/' ).''. ('['^ (
')')). '\\'.'$' .'~' .'='
.'~'.( '{'^'.'). '?'. ('['
^')') .(('`')| '%') .''.
('['^ "\-").( '`'| '%')
.''. ("\["^ ')') .''.
('[' ^(( '(') )).(
'`'| '%' ).+ (((
((( ((( ((( (((
((( ((( ((( (((
((( ((( ((( ((
(( '\\')) ))
)) ))))) ))
)) )))))))) ))
))) )))) ))))) ))
).+ ('@'). '~'. ':'
.''. '\\'.'@' .(( '~')
).'"'. ('}').
')');$:= '.'^'~'
--------------------------------------------------------------------