Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. tower_x = []
  2. tower_y = []
  3.  
  4. def setup ():
  5. global tower_x
  6. global tower_y
  7. size (500, 500)
  8. background (32, 77, 15)
  9. calc()
  10. def calc():
  11. while len(tower_x) <3:
  12. x = random (0, 500)
  13. y = random (0, 500)
  14.  
  15. #dist something <=120 (centers of gray circles must be 120 pixels away from each other)
  16.  
  17. tower_x.append(x)
  18. tower_y.append(y)
  19. validate();
  20. def validate():
  21. for i in range (2) :
  22. delay(100)
  23. if dist(tower_x[i], tower_y[i], tower_x[i+1], tower_y[i+1]) < 120:
  24. calc();
  25. println("test");
  26. else:
  27. background (32, 77, 15)
  28. for i in range (len(tower_x)):
  29. fill (255, 255, 0)
  30. ellipse (tower_x[i], tower_y[i], 240, 240)
  31. fill (150)
  32. ellipse (tower_x[i], tower_y[i], 30, 30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement