Advertisement
jabela

MazeRunner

Dec 8th, 2018
1,578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.64 KB | None | 0 0
  1. import turtle
  2. import random
  3.  
  4. turtle.screensize(1000, 1000, "white") #Added to make this work on smaller screens
  5.  
  6. r1 = random.randint(20,700)
  7. t1 = (800-r1)/2
  8.  
  9. r2 = random.randint(20,700)
  10. t2 = (800-r2)/2
  11.  
  12. r3 = random.randint(20,700)
  13. t3 = (800-r3)/2
  14.  
  15. r4 = random.randint(20,700)
  16. t4 = (800-r4)/2
  17.  
  18. r5 = random.randint(20,700)
  19. t5 = (800-r5)/2
  20.  
  21. r6 = random.randint(20,700)
  22. t6 = (800-r6)/2
  23.  
  24. r7 = random.randint(20,700)
  25. t7 = (800-r7)/2
  26.  
  27. r8 = random.randint(20,700)
  28. t8 = (800-r8)/2
  29.  
  30. r9 = random.randint(20,700)
  31. t9 = (800-r9)/2
  32.  
  33. randomr = [r1,r2,r3,r4,r5,r6,r7,r8]
  34. randomt = [t1,t2,t3,t4,t5,t6,t7,t8]
  35.  
  36. turtle.speed(0)
  37. turtle.up()
  38. turtle.goto(-400,350)
  39. turtle.down()
  40.  
  41. for i in range(7):
  42.     turtle.forward(randomr[i])
  43.     turtle.up()
  44.     turtle.forward(randomt[i])
  45.     turtle.down()
  46.     turtle.forward(randomt[i])
  47.     turtle.right(90)
  48.     turtle.forward(40)
  49.     turtle.right(90)
  50.     turtle.forward(randomr[i])
  51.     turtle.up()
  52.     turtle.forward(randomt[i])
  53.     turtle.down()
  54.     turtle.forward(randomt[i])
  55.     turtle.left(90)
  56.     turtle.forward(40)
  57.     turtle.left(90)
  58.  
  59. turtle.forward(r9)
  60. turtle.up()
  61. turtle.forward(t9)
  62. turtle.down()
  63. turtle.forward(t9)
  64. turtle.left(90)
  65. turtle.forward(800)
  66.  
  67. turtle.up()
  68. turtle.goto(-400,350)
  69. turtle.down()
  70. turtle.back(600)
  71. turtle.up()
  72. turtle.color("red")
  73. turtle.shape("turtle")
  74. turtle.goto(-400,380)
  75. turtle.right(90)
  76. turtle.pendown()
  77.  
  78. # You simply have to beat the maze
  79. # You are not allowed to change code above, go round the outside, teleport etc.
  80. # This challenge was made by a year 9 girl!
  81. # Start coding the solution below.
  82. # You can use lists & variables above to help.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement