Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine


by Adam (Vicar)
on Aug 23, 2000 at 02:11 UTC ( #29124=obfuscated: print w/replies, xml ) Need Help??

Here is the entry that I sent into the TPJ 5th annual obfuscated Perl contest. I entered it in as a diversion. The code is actually a team effort, I wrote the core and then Tye and I set to work obfuscating and souring (removing the sugar from) the code. And yes, it is 'strict' and does not generate warnings when used correctly. It can also take user input on the command line.
($@,$?)=(@ARGV,9,9);$:=1-$?*$@;print"# ",'##'x($@-2),"# # ";$_[0][$_]=$_[$?+1][$_]=8for 0..$@;$_[$_][0]=$_[$_][$@+1]=8for 0..$?;$/=1+rand$?,$.=1+rand$@;@@=[$.,$/];$_[$/][$.]=$^=4;while($:) {$"=$^-->3?rand 4:++$"%4;1>$"?$.--:2>$"?$/--:2^$"?++$/:$.++;if($_[$/][ $.]&&1){pop@@,$^=4if!$^;($.,$/)=@{$@[-1]};next}$_[$/][$.]=$^=4;$"< 2?$_[$/][$.]|=1<<$":($_[$@[-1][1]][$@[-1][0]]|=1<<$"-2);push@@ ,[$.,$/];++$:}print"#",map({$_%2?' ':' #'}@$_[1..$@])," #",map({2&$_?' #':'##'}@$_[1..$@]),"\n"for@_[1..$?]
Disclaimer: The contest required the code to work under Perl 5.6, some things in this code might not work on older versions of Perl. (Although I think it will work with versions 5.005 and newer)

Update: Nov 2, 2000
Well, the results are in over at TPJ, and we didn't win. We didn't even place.
Oh well, there is always next year!

Replies are listed 'Best First'.
(bbq) RE: OneWay
by BBQ (Deacon) on Sep 01, 2000 at 20:44 UTC
    Very cool! Worked nicely on my machine...
    version 5.005_03 built for i586-linux

    # Trust no1!
RE: OneWay
by Rydor (Scribe) on Sep 03, 2000 at 04:52 UTC
    Cool, but one problem.... The solution to the maze 9 out of 10 times is just go down, over to the right, and right back up. it generally ignores the lower part of the maze.

      That's the problem with taking a fully solveable - randomly generated maze and then sticking the entrances that close together. In order to stay with-in the char count for TPJ, I was forced to drop the random entrance code. You can, of course, pick any starting and ending points you want. You can also generate larger mazes (reducing the likely-hood of an overly simplistic one) by running the script with your desired dimensions on the command line. 39 20

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://29124]
Approved by root
[stevieb]: been thinking... if it wasn't for Perl, I believe that I'd be done in tech. I don't do social media or the like, if I'm not coding I'm not on a device at all, and don't miss comms at all when I'm not around. I code for my job (which I like), but I think..
[stevieb]: ...I haven't coughed up my laptop because of Perl.
[stevieb]: I think that Perl is the reason that I haven't gone 100% off grid :)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2017-03-29 02:14 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (343 votes). Check out past polls.