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

pawel.biernacki

by pawel.biernacki (Acolyte)
on Feb 23, 2018 at 18:35 UTC ( #1209854=user: print w/replies, xml ) Need Help??

($w,$h)=(25,10);%l=map{$_,{map{$_,0}1..$h}}1..$w;sub t{my($x,$y)=@_;$l +{$x}{$y}|=1;my@c=grep{exists($l{$$_[0]}{$$_[1]})&&!$l{$$_[0]}{$$_[1]} +&1}map{[$x+$$_[0],$y+$$_[1],$$_[2]]}([-1,0,2],[1,0,2],[0,-1,4],[0,1,4 +]);@c&&do{$c=$c[int(rand(@c))];$l{$x<$$c[0]?$x:$$c[0]}{$y<$$c[1]?$y:$ +$c[1]}|=$$c[2];t(@$c);t($x,$y);}}t(12,5);print join("",map{$y=$_;"X". +join("X",map{$l{$_}{$y}&2?"-":" "}1..$w)."\n".join(" " ,map{$l{$_}{$y}&4?"|":" "}1..$w)."\n" }1..$h);

The code above is a maze generator.

As you might have guessed I am a programmer. Take a look at my website http://www.pawelbiernacki.net .

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2018-10-21 18:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (119 votes). Check out past polls.

    Notices?