I found it helped to make a little class to reason more easily about moving.
```js const GRID_SIZE = 31;
class Mover { constructor(x, y) { this.x = x; this.y = y; this.instructions = [ { moveX: -Math.floor(GRID_SIZE / 2) + x, moveY: -Math.floor(GRID_SIZE / 2) + y } ]; }
_i(x, y) { this.instructions.push({ moveX: x, moveY: y }); }
e(n, step = 1) { for (let i = 0; i < Math.abs(n); i += step) { const move = Math.sign(n) * step; this.x += move; this._i(move, 0); } }
se(n, step = 1) { for (let i = 0; i < Math.abs(n); i += step) { const move = Math.sign(n) * step; this.x += move; this.y += move; this._i(move, move); } }
ne(n, step = 1) { for (let i = 0; i < Math.abs(n); i += step) { const move = Math.sign(n) * step; this.x += move; this.y -= move; this._i(move, -move); } }
s(n, step = 1) { for (let i = 0; i < Math.abs(n); i += step) { const move = Math.sign(n) * step; this.y += move; this._i(0, move); } }
w(n, step) { this.e(-n, step); }
n(n, step) { this.s(-n, step); }
nw(n, step) { this.se(-n, step); }
sw(n, step) { this.ne(-n, step); }
moveX(x) { this.e(x - this.x); }
moveY(y) { this.s(y - this.y); }
move(x, y) { this._i(x - this.x, y - this.y) this.x = x; this.y = y; } }
```