### Perl Racer

by turnstep (Parson)
 on Jan 09, 2001 at 16:58 UTC Need Help??

Not what you might think it is...

```
#!perl -w
use strict;\$|++;my\$X=1;my\$Y=5;if
(shift){\$X=3;\$Y=6;}@_=split(m//,
" \\;'\@0");splice@_=>2,0=>"";my
\$racer=q!s/(.)/\$-=3**\$;++;\$=+=\$-*\$1

/goSpeedgo!;

\$racer=~tr/Spdx//d;sub or()
{while(\$\$=~m(((\d{2,3})*((?<!^)(([^\n]{3})))[A-Z]*))g)
{\$==\$;   =\$^S;(\$_=\$5gt\$3?\$                    4gt\$5?\$1
:\$2:\$1)   =~y.\.\-_.120.;    eval\$racer;\$@=()  ;(\$^[.=
chr (\$=   +65))=~y[\[][ ]    =~y!\!!\!\!!d;}   \$==chop
(\$==hex(   \$=));for(split   (m=\x51==>\$^[)){   (\$@->{qq
{\$_[++\$/    ]\n}}=\$_)=~y    (JXZ)(.!@);}\$/=    chr\$/+--\$/;
\$\$="";\$?=                  16;\$:=chop(\$:=   '\$|');\$.=-6;my
\$d=" "x22;my\$JAPH=reverse"JustAnotherPerlHacker ";\$%=-25;
my@S=(30,65,17,72,21,7,41,5,62,8,65,84,1,12,12,57,46,4,16);
my\$M5=                                         "O-O";\$-=-7;
my \$C=                                         \$:." "x(22)
.\$:;\$;=chop\$JAPH;{for(1..\$?)   {\$^X=\$d;for(1   ..rand(\$X
)+1){substr(\$^X,rand(22),1)=   "*";}if(++\$%>   1 and rand
(\$Y) <1){substr(\$^X,rand(19),   3," \$; ");}    unshift@\$,
++\$.<1?"\$:\$d\$:":"\$:\$^X\$:";}\$?                 =1;(\$C=pop@\$)
=~s/[BN]/ /g;substr(\$C,\$=,3,\$M5);print"\n"x\$S[0];for(1..15
){print"\040\040\040\040\040\$\$[\$_-1]\n";}printf"\040\040";
printf                                         "\040\040";
printf                                         "\040\$C T";
printf    "%c%d%cM:%d%c"    ,58,time-\$^T,32,   ++\$-,32*1;
printf    "B:\$S[7]\040\b    \b\b\bN%c%d\40"    ,58,\$S[12];
printf    "S%c \b%s%c\n"    ,58,\$S[17], 867    +5309-6144;
printf    "\40\40\040%c"    ,32; print"\40"    ,"_"x(24),"
\040\40\040\40\b\040\$\$\n\n";\$JAPH or\$a=~s/[^\@]/0/g;!\$JAPH
and \$a=~s/(.).{0,}/\$1\n/;\$@->{"\\\n"} =~s/(([^ ]+)( ))(.*)/
printf                                         "%s%s%s%s",\$1
#\$+=\$-                                         ;chop(\$JAPH);
,join(    \$_[0],@_[3..4]    ),\$3,\$4/oe;last    if\$a;\$S[10-9]
=time;    \$a=<>; next if    \$!+=time -\$S[1]    and time-\$S[1]
>3 and    \$a= "'\n";next    if(\$a=~/^;\$/and    defined\$=--
and \$C    !~s/[^\$:]\$M5([    Z]{0})/\$M5 /)or    (\$a=~/^'\$/and
\$=++and\$C!~/\$M5[^\$:]/)or(\$a=~/^;;\$/and\$S[17]and defined
(\$=-=2)and--\$S[17]and\$C!~/[^\$:]{2}\$M5/)or(\$a=~/^''\$/and\$S[17]
and  \$=                                       +=2and--\$S[17]
and \$C!~                                      /\$M5[^\$:]{2}/
)or(\$a=~    / /and\$S[7] and substr(\$\$[-1],    \$=,3,"   ")and
--\$S[7]&&    0);{if(\$a=~/n/i and\$S[12]) {    --\$S[12];my\$i=
15-1;\$\$[\$i    --]=~s/[^\$:]/ /g while\$i>     15-5}\$\$[-1]=~
/^.{\$=}(?:p    ){0}(.{3})/;next if(\$_=     \$1)=~/\*/and\$a=
"Q"; if(\$_=~    /[^ ]/){\$\$.=\$;lt'a'?      " \$;":\$;;my\$J=chop
(\$JAPH); for(                            @\$){s/\$;/\$J/;}next
unless\$JAPH; \$;                        =\$J;\$S[rand(17)+3]++;
}undef\$a;last;}redo;}\$@->{"0\n"}.=\$!+\$-;\$a=~s{[;']{1,2}}{;}g;
exists\$@->{\$a}or\$a=\$/;print"\$@->{\$a}\n";exit;}\$\$-=\$\$;while
(<DATA>){m/#+/and &or or(\$\$.=\$_)=~s/[\n ]//mg;}__DATA__
-_-__-.._---...---___..._._---__-_-.___-__.._.-.-__--.
_____-.-_-.-----_.-..-..._.----..-_-._-----._-..--.---
._-.-____._----._____--.--..._-_.-.-.-._---..-_----_._
--.-.._.-.._-----.--__-_.-                 _._-----..-
._-._---._-.                               -_.._----__
-_.     --_-                               ._-._-.-.-.
._-     -..-                               ..---__--_.
-....--.----                               _---..-_---
-..-.._--..._---..____._-.                 ._...---.__
_-----___---_-_--.-_-.._-.-.-._-..._--.-_..--._--_---.
...__-._-..__-.__.-__-.._...-._---..-_----..---_...-.-
---_---..-_----_-_-..._----___---__--__-..--..._----..
-._---
#

Replies are listed 'Best First'.
Re: Perl Racer
by turnstep (Parson) on Jan 09, 2001 at 17:00 UTC

This one also contains a hidden message, for those inclined to dig deep. The message can be revealed by running the program in a certain way. If you run the script, you may understand more...

Some of the posts "below" this one give away some of what this program. If you are truly sadistic and want to figure out what it does before running it, don't read any further. :)

Chipmunk!!! Nope, I'm lost. I get what appears to be Galaga (just played it on the 20th anniversary machine - 50 cents!) and then I'm off the cliff, no matter what.

a

I dunno, I managed to hit a barrel. The steering seems to be a little shakey.

Update: I especially liked the use of \$JAPH (more so now that I'm getting the hang of the steering.)

Ok I got a Score of 332 in easy mode. Maybe I'll try for a better score later. Nice code turnstep!

Re: Perl Racer
by halxd2 (Monk) on Jan 11, 2001 at 02:14 UTC
Now here is an example of a flaw in our point system. I can only give one vote to code which I should humbly submit my total xp.

For those having trouble, use the following keys:

• ; (semi-colon) to go left
• ' (apostrophe) to go right
• <CR> (Enter) to go straight
• And the powerups (N <space> ;; and '')
• Hit Enter after each key, and only hit it once

Create A New User
Node Status?
node history
Node Type: obfuscated [id://50667]
Approved by root
help
Chatterbox?
 [Your Mother]: The exhibit, the tick, or the scrotum? [erix]: (the man is even a paleontologist ) [1nickt]: erix unfortunately that's there favourite spot. That's why they are usually spotted crawling *up* your leg. [erix]: ha, the tick and, as it happens, also the curator (now a professor of Paleont.) [1nickt]: s/there/their/, ugh sorry. [Your Mother]: Heh. The only one I ever had on me, I caught on my shin, headed north. erix looks nervously I got away cleanly from my run , it seems :) 1nickt doesn;t remember there being ticks in the old country ... erix too fast for ticks! [erix]: 'the old country' is where?

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2017-05-24 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My favorite model of computation is ...

Results (184 votes). Check out past polls.