Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randrange
- import sys
- c=[]
- r=[[]]
- l=0
- elems=5
- for x in range(elems):
- c=c+[[randrange(360),randrange(100),randrange(100)]]
- c=sorted(c,key=lambda l: l[0])
- for x in range(elems-1):
- r[l]=r[l]+[c[x]]
- if (c[x+1][0]-c[x][0])>=30:
- l+=1
- r=r+[[]]
- r[l]=r[l]+[c[x+1]]
- if 360-r[-1][-1][0]+r[0][0][0]<30:
- r[0].insert(0,r[-1])
- r.pop()
- print r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement