Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import turtle
- wn = turtle.Screen()
- wn.bgcolor("powderblue")
- wn.title("Maze Generator")
- wn.setup(1300,700)
- wn.tracer(0)
- pen=turtle.Turtle()
- pen.hideturtle()
- pen.up()
- pen.color("white")
- pen.goto(0, -250)
- pen.write("MAZE TESTING",False,"center",font=("Arial Narrow",20,"bold"))
- class Maze(turtle.Turtle):
- def __init__(self):
- turtle.Turtle.__init__(self)
- self.shape("square")
- self.color("white")
- self.penup()
- self.speed(0)
- def setup(grid):
- global start_x, start_y, end_x, end_y
- for y in range(len(grid)):
- for x in range(len(grid[y])):
- character = grid[y][x]
- screen_x = -588 + (x * 24)
- screen_y = 288 - (y * 24)
- if character == "+":
- maze.goto(screen_x, screen_y)
- maze.stamp()
- walls.append((screen_x, screen_y))
- maze = Maze()
- walls = []
- #MAIN PROGRAM
- grid = [
- "++++++++++++++++++++++++++++++++++++++++++++++",
- "+ c+",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ +",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ +",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ +",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ +",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ +",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ +",
- "+ ++++++++++++++++++++++++++++++++++++++++++ +",
- "+ +",
- "+o +",
- "++++++++++++++++++++++++++++++++++++++++++++++",
- ]
- setup(grid)
- wn.exitonclick()
- #MADE BY AVMP
- #https://www.youtube.com/channel/UCQor7IURWM-lGT-tmFbFSCw
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement