def chooseAction(yp, rc, bc):
out = np.array(['move', 'false'])
if rc[0]!=-1 and bc[0]!=-1:
if distance(yp,rc)<50 and distance(yp,bc)<50 and distance(rc,bc)<50 :
out[0] = 'drag'
out[1] = 'true'
# print 'dragging'
return out
elif distance(rc,bc)<40:
out[0] = 'left'
# print 'left click'
return out
elif distance(yp,rc)<40:
out[0] = 'right'
# print 'right click'
return out
else:
# print 'moving'
return out
else:
out[0] = -1
return out
# Movement of cursor on screen, left click, right click and dragging actions are performed here
评论列表
文章目录