Actions and the Swap Rule
Actions are transformations that rearrange the letters in your selection. They cost coins and are the core strategic layer of GeoWords — finding cost-efficient action sequences to maneuver letters into playable words.
The Four Actions
All actions require a selection of 2 or more tiles.
Swap Ends
Swaps the first and last letters of the selection. The middle letters stay in place.
- Example: TABH → HABT
- Keyboard shortcut:
S
Reverse
Mirrors the entire selection — the first letter becomes last, the last becomes first, and everything in between reverses.
- Example: TABH → HBAT
- Keyboard shortcut:
R
Cycle Forward
Moves the last letter to the first position. Every other letter shifts one position toward the end.
- Example: TABH → HTAB
- Keyboard shortcut:
W
Cycle Backward
Moves the first letter to the last position. Every other letter shifts one position toward the start.
- Example: TABH → ABHT
- Keyboard shortcut:
Q
The Swap Rule
All action costs are derived from a single principle: one adjacent swap costs 1 coin.
An "adjacent swap" is the simplest possible letter rearrangement — exchanging two neighboring letters. Every action can be decomposed into a minimum number of these atomic swaps, and that number determines the cost.
Cost Formulas
For a selection of length n:
| Action | Formula | n=2 | n=3 | n=4 | n=5 | n=6 |
|---|---|---|---|---|---|---|
| Swap Ends | 2n − 3 | 1 | 3 | 5 | 7 | 9 |
| Reverse | n(n−1)/2 | 1 | 3 | 6 | 10 | 15 |
| Cycle Forward | n − 1 | 1 | 2 | 3 | 4 | 5 |
| Cycle Backward | n − 1 | 1 | 2 | 3 | 4 | 5 |
Why These Costs?
- Swap Ends: One letter bubbles through the chain to the other end (n−1 swaps), then the displaced letter bubbles back (n−2 swaps). Total: 2n−3.
- Reverse: Every pair of letters is inverted. The number of inversions in a full reversal is n(n−1)/2.
- Cycle Forward/Backward: One letter bubbles through the entire chain. That's n−1 adjacent swaps.
Cost Optimization as Strategy
The same rearrangement can often be achieved at different costs depending on which actions you choose. For example, to transform TABH into BATH:
| Recipe | Actions | Total Cost |
|---|---|---|
| A | Reverse → Cycle Backward | 6 + 3 = 9C |
| B | Cycle Forward → Reverse | 3 + 6 = 9C |
| C | Reverse → Cycle Forward × 3 | 6 + 3 + 3 + 3 = 15C |
Recipes A and B reach the same result at the same cost via completely different paths. Recipe C works but costs significantly more. Finding the cheapest recipe is part of the puzzle.
Action Buttons
The right sidebar shows buttons for each action, with the current cost displayed (e.g., "Reverse (6C)"). Buttons are disabled when:
- The selection has fewer than 2 tiles
- You don't have enough coins to pay the cost
- The selection contains locked tiles (in Lock Down mode)
Undo and Redo
All actions are fully undoable. Cmd+Z undoes the last action and refunds the coins. Cmd+Shift+Z redoes.