Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p1=[-8,-10,0]
- p2=[5,5,10]
- p3=[2,-7,3]
- p4=[9,-8,-3]
- v1=[0,0,0]
- v2=[0,0,0]
- v3=[0,0,0]
- v4=[0,0,0]
- def update(a,b,temp):
- if a[0]>b[0]:
- temp[0]-=1
- elif a[0]<b[0]:
- temp[0]+=1
- if a[1]>b[1]:
- temp[1]-=1
- elif a[1]<b[1]:
- temp[1]+=1
- if a[2]>b[2]:
- temp[2]-=1
- elif a[2]<b[2]:
- temp[2]+=1
- return temp
- stop=False
- s=0
- def step():
- global v1,v2,v3,v4,p1,p2,p3,p4,history,s,stop
- for i in [p1,p2,p3,p4]:
- for j in [p1,p2,p3,p4]:
- if i!=j:
- if i==p1:
- v1=update(i,j,v1)
- elif i==p2:
- v2=update(i,j,v2)
- elif i==p3:
- v3=update(i,j,v3)
- else:
- v4=update(i,j,v4)
- p1=[x + y for x, y in zip(p1, v1)]
- p2=[x + y for x, y in zip(p2, v2)]
- p3=[x + y for x, y in zip(p3, v3)]
- p4=[x + y for x, y in zip(p4, v4)]
- s+=1
- if v1==[0,0,0] and v2==[0,0,0] and v3==[0,0,0] and v4==[0,0,0]:
- print(s*2)
- stop=True
- while not stop:
- step()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement