def paddle_top(observation, paddle="right"):
column = observation[:, PADDLE_COLUMN[paddle], :] - PADDLE_COLOR[paddle]
found = (np.sum(np.abs(column), axis=1) < TOLERANCE).astype(np.int)
r = np.argmax(found)
if not found[r]:
return None
else:
return r
# def ball_center(observation):
# w = np.where(np.abs(observation[:,6:36] - 0.30457518) > TOLERANCE)[:2]
# if len(w[0]) == 0 or len(w[0]) > 4:
# return None
# w = np.mean(w, axis=1)
# return w[0], w[1] + 6
#
# def ball_on_left(observation):
# w = np.where(np.abs(observation[:,6:21] - 0.30457518) > TOLERANCE)[:2]
# return(len(w[0]) > 0)
评论列表
文章目录