```
const gridSize = {rows: Math.max(hero.getLavaMap().length, hero.getLavaMap()[0].length), cols: Math.min(hero.getLavaMap().length, hero.getLavaMap()[0].length)};
Math.mod = (n, m) => n - m * Math.floor(n / m);
hero.setDir = d => {
hero.dir = d;
switch (d) {
case 0:
return hero.moveUp();
case 1:
return hero.moveRight();
case 2:
return hero.moveDown();
case 3:
return hero.moveLeft();
}
}
hero.waitUntil = (t, n) => {
while (true) if (hero.getRowAndCol()[t] === n) break;
}
hero.getRowAndCol = (x, y, array) => (array ? [(x ? x : hero.x) * 0.5 - 1.5, (y ? y : hero.y) * 0.5 - 1.5] : {row: (x ? x : hero.x) * 0.5 - 1.5, col: (y ? y : hero.y) * 0.5 - 1.5})
hero.navigateTo = (row, col) => {
let pos = hero.getRowAndCol();
if (pos.row !== row) {
let n = pos.row < row ? 2 : 0;
hero.setDir(Math.abs(pos.row - row) > gridSize.rows * 0.5 ? Math.abs(n - 2) : n);
}
hero.waitUntil('row', row);
if (pos.col !== col) {
let n = pos.col < col ? 3 : 1;
hero.setDir(Math.abs(pos.col - col) > gridSize.cols * 0.5 ? Math.abs(n - 2) : n);
}
hero.waitUntil('col', col);
}
hero.left = () => (hero.setDir(Math.mod(hero.dir - 1, 4)));
hero.right = () => (hero.setDir(Math.mod(hero.dir + 1, 4)));
hero.navigateTo(1, 1);
```

`hero.navigateTo`

isnâ€™t working for whatever reason, idk whyâ€¦