1 2 3 4
xup = max(0, min(xup + 1, 9 + 1)) yup = max(0, min(xup + yup, 9 + yup)) xlow = max(0, xlow-1) ylow = max(0, ylow + xlow)