Maze generation: Difference between revisions
Content added Content deleted
(Added POV-Ray solution) |
m (→{{header|POV-Ray}}: Removed some unnecessary debugging code) |
||
Line 7,289: | Line 7,289: | ||
#declare Cols = 17; |
#declare Cols = 17; |
||
#declare Seed = seed(2); // A seed |
#declare Seed = seed(2); // A seed produces a fixed sequence of pseudorandom numbers |
||
#declare Wall = prism { |
#declare Wall = prism { |
||
Line 7,348: | Line 7,348: | ||
#local Col = floor(rand(Seed)*(Cols-1) + 0.5); // Random start column |
#local Col = floor(rand(Seed)*(Cols-1) + 0.5); // Random start column |
||
#local Top = -1; |
#local Top = -1; |
||
#local Max = -1; |
|||
Push(Stack, Top, Row, Col, Row, Col) |
Push(Stack, Top, Row, Col, Row, Col) |
||
Line 7,377: | Line 7,376: | ||
Push(Stack, Top, Row, Col, Row, Col-1) |
Push(Stack, Top, Row, Col, Row, Col-1) |
||
#end |
#end |
||
#end |
|||
#if (Top > Max) |
|||
#declare Max = Top; |
|||
#end |
#end |
||
Line 7,467: | Line 7,462: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
[[File:Povray maze solution 640px.png|640px|frame|none|alt=POV-Ray maze|POV-Ray solution]] |
[[File:Povray maze solution 640px.png|640px|frame|none|alt=POV-Ray maze with red brick walls|POV-Ray solution with 15 rows and 17 columns]] |
||
=={{header|Processing}}== |
=={{header|Processing}}== |