"""
快速查找列表位置移动方法
"""
list01=[["01","02","03","04"],
["10","11","12","13"],
["20","21","22","23"],
]
class Vector2:
"""
二维向量
可以表示位置/方向
"""
def __init__(self,x,y):
self.x = x
self.y = y
#函数:表示左边方向
def left():
return Vector2(0,-1)
def right():
return Vector2(0,1)
#移动=方向+位置
post = Vector2(1,2)
move =left()
post.x+=move.x
post.y+=move.y
print(post.x,post.y)
python快速查找位置移动方法
最新推荐文章于 2022-10-22 20:00:46 发布