This hard-G gif intrigues me. How would this menu be implemented?

Say we had a 2 by 3 menu.

```
1 | 2
3 | 4
5 | 6
```

We start off on the upper left item, 1. Pressing down moves us to the second row. (3). Pressing right (or left on a wrap-around menu) would take us to to the second column of the second row. (4). We could just treat the cursor position as a "point" with an x and a y. Up and down would affect the y and left and right the x. Just add in some checks for bounds and the cursor's position could be shown based on that "point".

Easy enough.

But this *Dragon Quest 7* pedestal menu is what? Three rows, two? columns? Let's look at the positioning.

```
1 | 2
3
4 | 5
```

Let's think about the cursor position as an (x, y) coordinate. On both this 2x3 and the X shape menus, 1 is (0, 0). We press down, moving to (0, 1). Press again and we'd be at (0, 2). Okay. Makes enough sense on the 2x3 menu. But how does that X work? Becaue we can see that it remembers which column it was on. And it will also remember what row it was on if we go left or right from 3. Start at 1, press down to 3, and press right. The cursor will end up at 2. However starting at 4 and pressing up to 3, pressing right will take the cursor to 5.

If we only store where the cursor was, how can this work?

```
Start: X = 0, Y = 0 = 1
Press down: (0, 1) = 3
Press down (0, 2) = 4
```

Okay, makes sense so far.

```
Press Right: (1, 2) = 5
Press Up: (1, 1) = 3?
```

Hm. Not right. What if we put in a check that if Y = 1, X must be set to 0?

```
Press Right: (1, 2) = 5
Press Up: (1, 1) = (0, 1) = 3
Press Left: (-1, 1) = Hm
```

Okay, so maybe storing it this way is not good. What if we just based it off of where we're coming from and the last position?

```
CUR = 1
OLD = 1
IF BUTTON.PUSHED
OLD = CUR
IF CUR = 1
UP: CUR = 4
DOWN: CUR = 3
LEFT: CUR = 2
RIGHT: CUR = 2
IF CUR = 2
UP: CUR = 5
DOWN: CUR = 3
LEFT: CUR = 1
RIGHT: CUR = 1
IF CUR = 2
UP: CUR = 5
DOWN: CUR = 3
LEFT: CUR = 1
RIGHT: CUR = 1
IF CUR = 4
UP: CUR = 3
DOWN: CUR = 1
LEFT: CUR = 5
RIGHT: CUR = 5
IF CUR = 5
UP: CUR = 3
DOWN: CUR = 2
LEFT: CUR = 4
RIGHT: CUR = 4`
```

Okay, those are the easy ones. Now for the hard one

```
IF CUR = 3
UP:
IF OLD = 1 OR 2 THEN CUR = OLD
ELSE IF OLD = 4 or 5 THEN CUR = OLD - 3
DOWN:
IF OLD = 4 OR 5 THEN CUR = OLD
ELSE IF OLD = 1 or 2 THEN CUR = OLD + 3
LEFT:
IF OLD = 1 OR 4 THEN CUR = OLD
ELSE IF OLD = 2 OR 5 THEN CUR = OLD - 1
RIGHT:
IF OLD = 2 OR 5 THEN CUR = OLD
ELSE IF OLD = 1 OR 4 THEN CUR = OLD + 1
```

This could probably be cruched down to check on direction first and then set the cursor based on where it was or wasn't. But I still feel like there is some possibly easier way that I am missing. Then again, so much seems simpler than it is.