r/programmingchallenges • • Sep 09 '11

Make a perfect maze.

A perfect maze is one that has one and only one path between any two points in it (without backtracking).

There are quite a few algorithms out there for this, but trying to make your own is good fun.

28 Upvotes

21 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Jan 25 '12

[deleted] — view deleted comment

2

u/PlainSight Jan 26 '12

How are you trying to execute the code? Are u pasting it into a .py file and running from the command line? Or are you using some kind of python shell where you can both write and execute code as you go?

If you are doing the latter you need to copy paste each code segment separately - 1 function/statement at a time. In this instance there will be 5 pastes the first being "import random", second "def printMaze(maze):..." and the last "printMaze(makeMaze(20,20))"

If you are just pasting into a .py file then as long as you have python installed correctly then yous should just able to navigate to your file in command prompt and type "python (filename).py"