Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

pawel.biernacki

by pawel.biernacki (Acolyte)
on Feb 23, 2018 at 18:35 UTC ( [id://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
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found