我目前正在使用 Turtle 开发一个圆形台球程序。我的问题是,一旦球到达圆的两侧以使其反弹,我无法弄清楚我需要给 Python 什么角度或位置。这是我的程序中需要修复的部分:
while nbrebonds>=0:
forward(1)
if (distance(0,y)>rayon): #rayon means radius
print(distance(0,y))
left(2*angleinitial) #I put this angle as a test but it doesn't work
forward(1)
nbrebonds+=(-1)