Spending Swaps: Reasoning Through Lens Parity in SlideScramble

A worked solving analysis using the Portable Lens column swap. The row-level state projections are an exact enumeration under a specified cost measure; the two complete-game solutions are supported by saved recordings. This is a study of a constructive strategy, not a claim that 14 is the absolute shortest possible game score.

The problem: spend a useful exchange, not a wasted one

The Lens Parity challenge starts with the first two rows solved. Its remaining rows are:

Row 3: 33  23  43  13
Row 4: 24  14  44  34

Each label is a tile’s home coordinate (column,row). For the projection tables, we’ll abbreviate the rows to 3241 and 2143 respectively, since the row identity is understood.

The question is not merely how to fix row 3. It is which correction to choose so that the column-swap lens can improve row 3 and spend a necessary exchange on row 4. Choosing a good first exchange may save a whole subsequent lens operation.

Vocabulary and the cost measure

Term Meaning here
Game move One committed whole-row or whole-column SlideScramble rotation. A two-cell drag still counts as one move.
Formula step One arrow in a shape-directed lens formula: a one-cell rotation of the indicated tile’s current row or column.
Column-swap operation (ColumnSwap) A complete Portable Lens transformation that exchanges the two horizontal neighbors in each of two neighboring rows, restoring surrounding tiles. It is not one game move.
Lens anchor (○@(x,y)) The starting location of ○ in the upper-left lens cell, with one-based column x and row y. The circle reference locates all four lens cells; it is not a drag-start coordinate.
Adjacent pair exchange A projected swap of entries at columns 1–2, 2–3, 3–4, or 4–1 around the wraparound row. This is our planning unit, not automatically a legal standalone game move.
Cyclic order An ordering equivalent to 1234 by rotating the row: 1234, 2341, 3412, or 4123.
Correction count The fewest adjacent pair exchanges required to reach any of those four cyclic orders; final alignment is counted separately.
Alignment / rectification A whole-row rotation after correct cyclic order has been achieved, placing the tiles in their exact home positions. It counts as a game move when executed.
Kink An exchange choice that leaves a more expensive correction path than an available alternative, under this row-level measure. This is the author’s practical terminology, not an assertion about global optimality.

We deliberately use one-exchange, two-exchange, and three-exchange states, rather than unqualified odd or even parity. Ordinary permutation parity is a different mathematical property. When we say a route uses two exchanges, we are counting projected adjacent pair exchanges to cyclic order—not two whole-line moves or two completed lens formulas.

Counting convention: swap neighboring positions on the cyclic four-cell ring, then take the shortest number of further such swaps to reach one of the four cyclic goal states. The tables below enumerate all four possible first exchanges. This count can be checked by a small breadth-first traversal of the 24 four-tile permutations; it is exact for this restricted row-level model.

Project row 3 before making a move

Start with
3241
(33 23 43 13). Consider every possible first adjacent exchange:

First adjacent exchange Projected row Exchanges remaining Total exchanges Example follow-up
Columns 1–2 2341 0 1 Already cyclic
Columns 2–3 3421 1 2 3–4
Columns 3–4 3214 2 3 1–2, 3–4
Columns 4–1 (wrap) 1243 1 2 3–4

Read these outcomes as projections; the table does not instruct you to perform four different operations in the game.

The first exchange (columns 1–2) immediately gives 2341, which is cyclically correct. This is the one-exchange route. Columns 2–3 produce 3421, and a second exchange of 3–4 gives 3412, also cyclically correct. The wraparound exchange 4–1 produces 1243, and swapping 3–4 gives 1234.

Columns 3–4 are the kink under this cost measure: 3214 requires two more adjacent exchanges, for a total of three, versus the one- and two-exchange alternatives. This is a concrete example of a move worth rejecting before spending it.

Key result for row 3: the projected counts are 1, 2, 3, 2 for columns 1 through 4. The 2–3 and 4–1 choices are equivalent in this correction count, although they produce different intermediate states and may interact differently with row 4.

Project row 4 with the same rules

Start with
2143
(24 14 44 34). Again, enumerate all four possible first adjacent exchanges:

First adjacent exchange Projected row Exchanges remaining Total exchanges Example follow-up
Columns 1–2 1243 1 2 3–4
Columns 2–3 2413 1 2 4–1
Columns 3–4 2134 1 2 1–2
Columns 4–1 (wrap) 3142 1 2 2–3

Here the result is striking: every first exchange leaves one further adjacent exchange to reach cyclic order. Row 4 therefore has correction count two, not one, if we restrict ourselves to exchanges between neighboring columns, including wraparound. The two visible reversed pairs are not themselves a complete strategy; which exchanges we choose matters because the column-swap lens must operate on both rows at once.

This distinction corrects an ambiguity in an earlier draft: one can solve 2143 with a single nonadjacent exchange (for example positions 1 and 3), but that is not an elementary exchange available through a neighboring-column lens. We do not use unrestricted swaps for these projections.

The key decision: match the exchange counts

A column-swap lens operation exchanges one adjacent pair in each of two neighboring rows. It spends one exchange from each row’s correction plan at the same time. The projections therefore become much more informative when we read them together:

Candidate first exchange for row 3 Row 3 total exchanges Row 4 total exchanges Planning consequence
Columns 1–2 1 2 Row 3 finishes early; another paired exchange still affects it and must be managed.
Columns 2–3 2 2 Matching budgets: two coordinated lens operations could correct both rows.
Columns 3–4 3 2 A kink: one extra row-3 exchange beyond row 4’s budget.
Columns 4–1 (wrap) 2 2 Matching budgets: another candidate for two coordinated lens operations.

Here is the selection rule: when a lens operation affects two rows simultaneously, look for correction routes with equal total exchange counts. In this puzzle, the two-exchange choices for row 3 (columns 2–3 or 4–1) match row 4’s two-exchange requirement. That is why choosing row 3’s apparently simpler one-exchange route can be less convenient for the combined puzzle.

Exchange budget: is the number of projected adjacent pair exchanges needed to bring a row into cyclic order, before any final alignment. A matched budget is a planning opportunity, not a guarantee of an immediately executable move sequence: each selected pair must also be reachable in the same two-column lens at the same time. Row rotations may be needed to bring the chosen pairs into register.

From the counts to the actual game moves

Write ColumnSwap ○@(x,y) to name the intended column-swap effect at the lens anchored by ○ at column x, row y. The unqualified ColumnSwap deliberately leaves the execution variant open. Both recordings use the ColumnSwap.UpLeft pattern; their correction blocks include alignments and combined full-line rotations, so each block of six saved game moves is not itself a substitute for the standalone eight-step formula. The Portable Lens guide documents its exact arrows.

  1. Count both rows first. Row 3 offers totals 1, 2, 3, 2; row 4 offers 2, 2, 2, 2. The candidate totals 2 and 2 match.
  2. Choose a compatible pair of two-exchange routes. The row-3 choices starting at columns 2–3 and 4–1 are equivalent by exchange count, but not necessarily by the row alignment they require. Inspect row 4’s candidate paths and select a pairing that can be realized by the same lens placements.
  3. Establish the first lens position. Rotate the working row if necessary. This is an actual game move, not an abstract exchange.
  4. Execute the first coordinated column-swap construction. Both rows receive a useful adjacent exchange. Their intermediate orders need not yet be cyclically correct.
  5. Align the next matching pairs and execute the second construction. When possible, the first construction’s ending alignment already supports the second, saving a game move.
  6. Rectify any remaining cyclic offset. Correct cyclic order may still require a final whole-row rotation to put every tile at its exact home position. That rotation belongs in the recorded score.

The 14-move recording demonstrates how the selected exchange budgets can be made to cooperate. At move 13, row 4 is solved and row 3 is cyclically ordered; move 14 performs the final rectification. The 15-move recording reaches the same goal with an additional intermediate alignment. Thus equal exchange counts explain which plan to investigate, while the recordings show how its placements and alignments affect the game-move score.

Matching budgets should not be confused with minimum total moves. A state with a larger row-level correction count is not automatically a worse whole-board state: alignments, available lens placements, and interaction between rows affect the implementation cost. The projections are a disciplined way to choose a constructive strategy, not a substitute for tracing the legal moves.

Generalizing the method

The reasoning is not limited to a 4×4 board. For a board with an even number of columns greater than two, treat each row as a cyclic sequence. Enumerate candidate adjacent exchanges—including the wraparound pair connecting the last and first columns—and estimate the exchanges remaining to a correctly cyclically ordered row. Where two neighboring rows offer matching correction budgets, look for aligned column-swap lens operations that spend one required exchange in each row.

The method also works perpendicularly: on a board with an even number of rows greater than two, analyze two neighboring columns and use row-swap lens operations to pair their vertical adjacent exchanges. As before, count the final whole-column alignment separately.

Scope: even-length rows and columns are a useful setting for this planning argument, but the portable lens itself also works on odd-sized boards. For larger boards, finding equal counts does not by itself prove that the corresponding exchange sequences can share the same lens placements or that the resulting solution minimizes the number of game moves. The remaining alignment and compatibility decisions are part of the strategy.

First recorded demonstration: 14 game moves

Initial board, initial alignment, intermediate projected states and final rectification of the 14-move solution

Point Row 3 Row 4
Start 33 23 43 13 24 14 44 34
After move 1 23 43 13 33 24 14 44 34
After move 7 33 43 23 13 14 24 44 34
After move 13 23 33 43 13 14 24 34 44
After move 14 13 23 33 43 14 24 34 44

The recording can be understood in four stages:

  1. Move 1 — establish the working alignment. Row 3 rotates left one cell, preparing the lens at ○@(1,3). This is the circle’s reference coordinate, not a drag-start position.
  2. Moves 2–7 — ColumnSwap ○@(1,3), first coordinated correction block. The first recorded group leaves row 4 as 14 24 44 34 and row 3 as 33 43 23 13. Both have useful remaining work; neither has to be solved exactly yet.
  3. Moves 8–13 — ColumnSwap ○@(3,3), second coordinated correction block. After this group, row 4 is completely solved, while row 3 is 23 33 43 13: correct cyclic order, but not yet aligned to home positions.
  4. Move 14 — final rectification. Rotate row 3 one cell right, transforming 23 33 43 13 into 13 23 33 43. The entire board is solved.

Why the rectification matters: the state at move 13 is not a completed solution. A correct cyclic order is a useful planning milestone, but the final whole-row alignment is a real game move and belongs in the score. This construction solves the puzzle in 14 committed moves, one fewer than the earlier 15-move reference challenge.

The symbolic labels give the intended local effect and anchor, not a six-step standalone formula. The groups are parts of one recorded construction, not independently verified six-move implementations of the generic eight-step column-swap formula. The initial alignment and move batching are integral to this specific solution. The full recording is preserved as
Project/CrystalCatalystLibrary.net/SlideScramble/lens_parity_article/lens-parity-14.json
. It can be copied into sessions in the binary directory for load.

Second recorded demonstration: 15 game moves

Initial board, first alignment, first correction, intermediate realignment, and final rectification of the 15-move solution

Point Row 3 Row 4
Start 33 23 43 13 24 14 44 34
After move 1 13 33 23 43 24 14 44 34
After move 7 43 33 13 23 14 24 44 34
After move 8 13 23 43 33 14 24 44 34
After move 14 43 13 23 33 14 24 34 44
After move 15 13 23 33 43 14 24 34 44

This route uses an additional intermediate row alignment:

  1. Move 1: rotate row 3 right one cell to prepare ○@(1,3) with a different working alignment.
  2. Moves 2–7 — ColumnSwap ○@(1,3): perform the first correction block. Row 4 becomes 14 24 44 34.
  3. Move 8: rotate row 3 by two cells to position the second correction at ○@(3,3).
  4. Moves 9–14 — ColumnSwap ○@(3,3): perform the second correction block. Row 4 is solved, and row 3 has correct cyclic order as 43 13 23 33.
  5. Move 15: rotate row 3 left one cell to rectify its exact position, solving the board.

The extra realignment is visible and counted. Thus the 15-move trace is not a worse explanation just because it scores one move more: it shows how the choice of working offset affects implementation cost while retaining the same broad strategy.

The full recording is
Project/CrystalCatalystLibrary.net/SlideScramble/lens_parity_article/lens-parity-15.json
.

The reasoning to take into the next puzzle

The most reusable insight is the project, match, then commit method:

  1. Identify cyclic order, not exact alignment, as the first target. A final rotation can rectify a row cheaply.
  2. Enumerate the four adjacent exchanges available around a four-cell wraparound row. Project the resulting order and count the remaining correction exchanges.
  3. Identify the kinks—choices that increase the remaining count without a compensating benefit elsewhere.
  4. Match the correction budgets. Prefer candidate paths that require an equal number of exchanges in the two rows, so each lens operation can contribute to both. Then verify the required pairs can be aligned in the same lens.
  5. Plan and count alignments. Establishing a lens position and rectifying the last cyclic offset are committed game moves, even though they are not abstract pair exchanges.
  6. Check the recorded board after each correction block. The point is not merely to reach a low number in the projection table but to construct a legal, reproducible game solution.

The projection tables are exhaustive within their restricted adjacent-exchange model. The paired-budget selection explains why 2 + 2 is a useful plan for this particular board. The recordings demonstrate 14- and 15-move solutions. Neither fact claims that all possible sequences of full-row and full-column SlideScramble rotations have been searched, or that 14 is globally optimal.

Recorded moves and reproducibility

The source files retain each move’s axis, line, signed offset, and drag-start position. The tables below omit drag-start coordinates for readability; the JSON is authoritative for replay.

14-game-move recording
Move Line Delta
1 Row 3 +1
2 Column 2 +1
3 Column 1 +1
4 Row 3 +1
5 Column 1 -1
6 Row 3 -2
7 Column 2 -1
8 Column 3 +1
9 Column 4 +1
10 Row 3 +1
11 Column 3 -1
12 Row 3 -2
13 Column 4 -1
14 Row 3 -1
15-game-move recording
Move Line Delta
1 Row 3 -1
2 Column 2 +1
3 Column 1 +1
4 Row 3 +1
5 Column 1 -1
6 Row 3 -2
7 Column 2 -1
8 Row 3 +2
9 Column 3 +1
10 Column 4 +1
11 Row 3 +1
12 Column 3 -1
13 Row 3 -2
14 Column 4 -1
15 Row 3 +1

The projected exchange counts were checked against all four cyclic targets using adjacent swaps on a four-position ring. The matching-budget criterion is a constructive heuristic whose placement and alignment requirements remain explicit. The recorded board states and saved move totals were checked by replaying the attached JSON sessions. The strategy and the term “kink” preserve the author’s observations and intended interpretation.

The source can be found in CrystalCatalyst on GitHub

Slide one row in SlideScramble and every tile in it moves. Slide a column and the same thing happens vertically. Can you use those board-spanning moves to rearrange just four neighboring tiles and put everything else back?

The Portable Lens grew out of playing with that question. Four shapes on graph paper made it possible to follow the same tiles as they moved. The sketches captured a pair of local swaps and a family of smaller shuffles. A Python simulation later made it possible to replay each formula and check every cell, even when the lens straddled the edge of the board.

Four tiles on a wraparound board

In SlideScramble, a move rotates a complete row left or right, or a complete column up or down. A tile that leaves one edge comes back at the opposite edge on the same line. Every cell is occupied throughout play. A blank cell in a lens diagram keeps its original tile.

Start with a 2×2 block. Call its upper-left tile ○ (circle), its upper-right tile ☆ (star), its lower-left tile △ (triangle), and its lower-right tile □ (square). The names travel with the tiles.

Given lens. Circle and star above triangle and square.

Given. The starting 2×2 lens.

Column swap. Star and circle above square and triangle.

Column swap. The left and right lens columns trade places.

Row swap. Triangle and square above circle and star.

Row swap. The upper and lower lens rows trade places.

Both swaps. Square and triangle above star and circle.

Both. Each tile trades places with its diagonal partner.

Apply the row and column swaps in either order to cross the lens. When using the formulas, assign the shapes afresh by position before the second swap. Apply both swaps again to uncross it.

Two local swaps, one eight-step pattern

In the Given arrangement, ○ and ☆ are on top, with △ and □ below. Write ○@(column,row) for the initial position of ○, counting from one at the upper left with the column first. Bind ☆ to the tile one cell right of ○, △ to the tile one cell below, and □ to the tile one cell down and right. Wrap at the board edges as needed.

ColumnSwap ○@(3,3) and RowSwap ○@(3,3) name the desired effects at that lens. To specify which formula to follow, write ColumnSwap.UpLeft ○@(3,3), RowSwap.LeftUp ○@(3,3), or Lens.CircleSquare.A ○@(3,3). The coordinate tells you where to bind the Given lens. Each arrow then tells you which tile to find for that step, so individual drag starts can be elsewhere.

A formula step is one arrow and rotates a whole row or column by one cell. A game move is one committed rotation and can cover several cells. A lens operation is the complete local transformation. An eight-step formula can therefore produce one lens operation even when a recording uses fewer than eight game moves.

Read a formula from left to right. △↑ means find the triangle where it is now, then rotate its entire column up one cell. A left or right arrow selects the tile’s current row. Follow the current position of each named tile. Before starting another complete operation, rebind all four shapes to the tiles now in the Given positions. Two identical tokens in a row, such as △→ △→, specify two successive one-cell steps.

Try ColumnSwap.UpLeft. The first step sends △ up one cell. The second sends the column containing □ up one cell. The third shifts □’s current row left. The lines being rotated can carry tiles well outside the lens, but after the eighth step the left and right lens columns have traded places and the rest of the board is restored. The row swap works on the top and bottom pairs in the same way.

All eight swap formulas have the shape sequence X Y Y Y X X X Z. Let a be the first arrow and b the third. The arrow sequence is a a b −a −b −b −a b, where a minus sign means the opposite arrow. For ColumnSwap.UpLeft, X is △, Y is □, Z is ☆, a is ↑ and b is ←. Once you recognize the pattern, each orientation comes down to choosing the shapes and the two starting directions.

The first shapes in the column-swap list are △, ○, □, ☆. The row-swap list starts ☆, □, ○, △ in exactly the reverse order. The symmetry is in how the formulas are listed.

Column-swap formulas
Formula Read left to right
ColumnSwap.UpLeft △↑ □↑ □← □↓ △→ △→ △↓ ☆←
ColumnSwap.DownLeft ○↓ ☆↓ ☆← ☆↑ ○→ ○→ ○↑ □←
ColumnSwap.UpRight □↑ △↑ △→ △↓ □← □← □↓ ○→
ColumnSwap.DownRight ☆↓ ○↓ ○→ ○↑ ☆← ☆← ☆↑ △→
Row-swap formulas
Formula Read left to right
RowSwap.LeftUp ☆← □← □↑ □→ ☆↓ ☆↓ ☆→ △↑
RowSwap.LeftDown □← ☆← ☆↓ ☆→ □↑ □↑ □→ ○↓
RowSwap.RightUp ○→ △→ △↑ △← ○↓ ○↓ ○← ☆↑
RowSwap.RightDown △→ ○→ ○↓ ○← △↑ △↑ △← □↓

The Shuffle Atlas

The atlas contains eight four-step formulas. The upper four cycle tiles clockwise, and the lower four cycle tiles counterclockwise, as seen on the board. Each step rotates the entire row or column containing the indicated tile at that moment.


Eight Shuffle Atlas formulas. Four clockwise cycles above four counterclockwise cycles. Matching inverse pairs line up vertically.
Each card pairs a live Shuffle.* gesture name with its Lens.* formula, four whole-line moves, and the resulting lens. A blank cell keeps its original tile. Corresponding upper and lower cards are inverses and share an A or B suffix.

For example, Lens.CircleSquare.A sends the upper-left tile to the upper right, the upper-right tile to the lower right, and the lower-right tile back to the upper left. That is a clockwise cycle, with the lower-left tile fixed. Lens.SquareCircle.A reverses it.

The shuffle as a three-position rotation

Rebind the four shapes by position before each application. Applying the same cycle three times restores the board. Applying it twice has the same effect as applying its inverse once.

To find an inverse in the atlas, look in the same column and corresponding row of the other half. The blank cell and A/B suffix match. For example, Lens.StarTriangle.B and Lens.TriangleStar.B undo each other.

Within a formula family, A and B use the same sequence of shapes with the arrow directions read in reverse order. Compare Lens.CircleSquare.A (○→ □↑ □← ○↓) with Lens.CircleSquare.B (○↓ □← □↑ ○→). Reversing a recording instead reverses the stored move order, flips each move’s direction, and updates its recorded drag start.

See the Shuffle Logic Addendum on GitHub for all eight live gestures, their before-and-after diagrams, and their inverses.

Read the eight atlas entries as text

Results list the top row followed by the bottom row. A dot (·) marks a cell whose tile stays put.

Shuffle Atlas formulas and resulting cycle directions
Atlas position Formula Live gesture Steps Result Direction
Upper left A Lens.TriangleStar.A Shuffle.TriangleCircle △↑, ☆←, ☆↓, △→ △ ○ / ☆ · Clockwise
Upper right A Lens.CircleSquare.A Shuffle.CircleStar ○→, □↑, □←, ○↓ □ ○ / · ☆ Clockwise
Upper left B Lens.SquareCircle.B Shuffle.SquareTriangle □←, ○↓, ○→, □↑ △ · / □ ○ Clockwise
Upper right B Lens.StarTriangle.B Shuffle.StarSquare ☆↓, △→, △↑, ☆← · △ / □ ☆ Clockwise
Lower left A Lens.StarTriangle.A Shuffle.StarCircle ☆←, △↑, △→, ☆↓ ☆ △ / ○ · Counterclockwise
Lower right A Lens.SquareCircle.A Shuffle.SquareStar □↑, ○→, ○↓, □← ☆ □ / · ○ Counterclockwise
Lower left B Lens.CircleSquare.B Shuffle.CircleTriangle ○↓, □←, □↑, ○→ □ · / ○ △ Counterclockwise
Lower right B Lens.TriangleStar.B Shuffle.TriangleSquare △→, ☆↓, ☆←, △↑ · □ / ☆ △ Counterclockwise

Take the lens to another part of the board

On paper, write each shape beside the value you see in its starting cell. For each arrow, find that written value on the board and rotate the row or column where it now appears. To move the technique elsewhere, make a fresh binding for the new 2×2 block.

Here is the guide’s centered 4×4 fixture. Each pair printed in the board is a tile’s home label. The column and row headers give its current position, counted from one at the upper left. For example, the ○ tile has home label (1,1) and starts at current position (2,2).

Centered 4×4 test board
Row Col 1 Col 2 Col 3 Col 4
1 (4,4) (1,4) (2,4) (3,4)
2 (4,1) ○ (1,1) ☆ (2,1) (3,1)
3 (4,2) △ (1,2) □ (2,2) (3,2)
4 (4,3) (1,3) (2,3) (3,3)

Write down ○ (1,1), ☆ (2,1), △ (1,2), □ (2,2). Try Lens.CircleSquare.A ○@(2,2). Its first step, ○→, sends row 2 right and carries both ○ and ☆. The second step, □↑, selects column 3, which now contains both □ and ○. Finish the last two steps and compare the center with the upper-right A diagram. Then check that the surrounding twelve cells match the starting board.

What the verifier checked

The Python verifier locates each named tile before each formula step, rotates its current line by one cell, and compares the resulting board with the expected permutation. It checks four column swaps, four row swaps, and eight atlas entries on the centered fixture. It also checks the common swap pattern and all four A/B directional relationships.

All 16 formulas passed at every 2×2 placement on 3×3, 4×4, 5×5, 5×3 and 7×6 boards, for 1,712 placement and board-size checks in addition to the centered fixture. That includes lenses crossing one or both wraparound boundaries. Each check compares the lens result and confirms that every other cell returns to its starting value. The tests establish the recorded outcomes on those boards. Whether the atlas exhausts the possible entry configurations up to symmetry remains open.

Run python3 verify_portable_lens.py from the SlideScramble source directory. Python verifier · Portable Lens guide

Solving, parity and recorded challenges

When much of the picture is already assembled, a local swap can move two pairs without disturbing the surrounding work at the end of the sequence. The atlas offers a different choice: cycle three tiles while holding the fourth fixed. Look at which tiles need to move and which must return to their present cells before choosing a formula.

Both lens swaps preserve permutation parity because each exchanges two pairs of tiles. A shuffle also preserves parity because cycling three tiles can be written as two pairwise exchanges. On a 4×4 board, a one-cell rotation of a whole line cycles four tiles and changes parity. This gives a practical distinction: use the lens to make local even rearrangements, and use a one-cell whole-line rotation when you need to change parity and can plan for its wider effects.

The companion Spending Swaps article shows how to choose a useful ColumnSwap by matching needed exchanges across neighboring rows.

SlideScramble’s challenge catalog stores the starting board and the recorded moves, so you can replay a solution or inspect it one step at a time. These four entries start from different 4×4 positions:

  • Lens-Column reversal. The two rightmost columns are exchanged within the bottom-right 2×2. The recording reaches the solved board in seven moves.
  • Lens-Row reversal. The two bottom rows are exchanged within the same 2×2. The recording also solves in seven moves.
  • Lens Parity. The bottom two rows start scrambled in different ways. The recorded solution takes fifteen moves.
  • Row reversal 1. Only the bottom row starts reversed. The recorded solution takes fifteen moves.

The recordings count committed game moves. The formulas here count one-cell steps. You can get SlideScramble and its challenge collection from the public repository. SlideScramble README · Challenge catalog · CrystalCatalystLibrary repository

Finding the Exponent: Binary Construction in Mercury’s Square Roots and Logarithms

How knowing where to begin—and knowing how to refine—turns continuous mathematics into computational algorithms.

Mathematics gives us familiar relationships:

x2 = a   and   bx = a

But a computer must answer a more concrete question: How can we construct the unknown value from a finite sequence of operations?

Mercury, an arbitrary-precision floating-point arithmetic library, offers an interesting perspective. Its square-root and logarithm algorithms approach their answers through successive binary contributions. Each candidate is tested against the value being sought, and the construction becomes progressively finer.

The algorithms have something important in common. But their differences reveal why some inverse operations are easier to begin than others.

The Advantage of Knowing the First Bit

Consider the square root:

x = √a

If we know the leading binary position of a, we can determine the leading binary position of its positive square root.

For example:

26 ≤ 100 < 27

Since 26 = 64 and 28 = 256, the square root falls between 23 and 24:

23 ≤ √100 < 24

The answer begins at binary position 3.

This gives an algorithm a useful starting point. It can begin with the contribution 23, then examine successively smaller powers of two.

Given a current approximation m, propose:

q = m + 2k

If q2 ≤ a, the contribution fits and can be retained. Otherwise, it is rejected.

The result is constructed one binary place at a time.

Notice what made the beginning convenient: squaring doubles the exponent of a power of two. The magnitude of the input therefore tells us where to begin constructing the root, even though the remaining bits still have to be tested.

But What If the Unknown Is the Exponent?

Now consider:

bx = a

The logarithm asks for the missing exponent:

x = logb(a)

For real logarithms, the target a must be positive and the base b must be positive and different from 1.

Unlike square-root extraction, we cannot generally read the leading position of x directly from the leading position of a. We must establish an appropriate exponent scale relative to the base.

Mercury’s logarithm implementation approaches this constructively. Repeated squaring or square rooting helps locate an initial power contribution. Once that scale is established, the algorithm can begin refining the unknown exponent.

For a positive exponent, think of candidate contributions in descending binary positions:

x ≈ bk2k + bk-12k-1 + bk-22k-2 + …

Here each binary choice bj is either 0 or 1. Not every term is retained. Each candidate contribution is tested according to whether its corresponding power moves toward or beyond the target. For bases below 1, the comparisons reverse direction, but the construction principle remains.

When refinement reaches fractional binary positions, the mathematical relationship becomes particularly elegant.

Why Square Roots Return to the Story

Consider a nonnegative exponent with fractional binary contributions:

x = n + b1/2 + b2/4 + b3/8 + …

where each bi is either zero or one.

Exponentiation gives:

ax = an × (a1/2)b1 × (a1/4)b2 × (a1/8)b3 × …

But:

a1/2 = √a

and:

a1/4 = √(√a)

Each additional square root corresponds to a finer fractional binary contribution.

This is the connection that makes Mercury’s constructive logarithm algorithm so interesting: square roots are not merely related to logarithms mathematically; they can supply the successive power contributions used to recover the exponent.

Mercury’s optimized logarithm implementation also maintains an accumulated power, avoiding the need to recompute the entire exponentiation for each candidate contribution. Its slower counterpart provides a useful contrast by recomputing candidate powers more directly.

Why Binary?

Binary is not required by the continuity of logarithms. A real logarithm is continuous on its positive domain, but continuity alone does not dictate an algorithm.

Binary refinement is attractive because it transforms a search into successive two-way decisions.

Each step resolves another binary position. Each fractional exponent step can be generated through square rooting. And each candidate can be evaluated against the target.

There is a useful sense in which two is the natural minimal integer subdivision factor: it creates the smallest possible nontrivial choice.

It is not, however, a universal optimum for numerical computation. Other algorithms can compute logarithms through different approximations and convergence methods.

Mercury’s value as an educational implementation lies partly in how clearly its binary approach exposes the construction.

Where Continuous Mathematics Meets Finite Precision

Mathematically, successive refinement can continue indefinitely. A computer cannot.

Mercury represents a value using a configurable number of 32-bit mantissa words. Each additional word supplies 32 more bits of stored precision.

Eventually, a proposed correction becomes too small to change the representable result. The continuous mathematical process has encountered the finite resolution of its numerical representation.

This distinction matters. A converged finite-precision calculation is not the same thing as an exact mathematical limit. But a well-designed numerical algorithm can approach that limit systematically, with precision chosen by the caller.

The Larger Lesson

Square roots and logarithms are inverse operations of different relationships, yet both demonstrate a powerful approach to numerical computation:

Find the scale, propose a contribution, test it, and refine.

For square roots, the initial scale follows naturally from the leading binary position of the input. For logarithms, the exponent scale must first be established relative to the base and target.

From there, binary refinement turns the search into a sequence of increasingly fine decisions.

That is one of Mercury’s most interesting educational qualities. The implementation invites us to examine not only the answer, but how the answer is constructed.

The mathematics is continuous. The algorithm proceeds through discrete decisions. Precision determines how far the construction can go.

And the source code lets us follow those decisions all the way down.

Continue Exploring Mercury

Compare the algorithms directly in the Mercury C implementation, follow the canonical Mercury reference, or explore the Mercury learning hub.

When Two Percentages Cancel: Hidden Direction in Same and Heads

A binary stream can be viewed in at least two natural ways. We can count its values—Heads and Tails—or we can count the relation between consecutive values—Same and Different. These views appear to describe different aspects of the stream.

But a simple subtraction reveals that they overlap in a surprisingly precise way:

SamePercentage - HeadsPercentage

This expression does not merely compare sameness with a preference for Heads. One entire class of transitions cancels out, leaving a directional measurement of what happened after Tails.

The Four Transitions

Every counted transition belongs to one of four classes:

HH  Head followed by Head
HT  Head followed by Tail
TH  Tail followed by Head
TT  Tail followed by Tail

Same transitions are:

Same = HH + TT

Transitions ending in Heads are:

Heads = HH + TH

Subtracting the second from the first gives:

Same - Heads
= (HH + TT) - (HH + TH)
= TT - TH

The HH contribution disappears completely.

SamePercentage - HeadsPercentage measures whether a preceding Tail was followed more often by another Tail or by a Head.

Its interpretation is direct:

  • A positive value means TT exceeded TH: Tails showed persistence.
  • A negative value means TH exceeded TT: Tails showed reversal.
  • A value near zero means neither direction dominated.

A subtraction between two broad percentages has secretly isolated one directional half of the transition table.

The Mirror Measurement

The corresponding Heads-side expression is:

SamePercentage - TailsPercentage

Here:

Same - Tails
= (HH + TT) - (HT + TT)
= HH - HT

This time TT cancels. What remains measures whether a preceding Head was followed more often by another Head or by a Tail.

We can provisionally name the pair:

  • Tail Continuation Balance: Same - Heads = TT - TH
  • Head Continuation Balance: Same - Tails = HH - HT

These are raw directional balances. They preserve both the direction of the effect and the amount of the stream that contributed to it.

The Pair Reconstructs the Familiar Geometry

Let:

D_T = Same - Heads
D_H = Same - Tails

Adding them gives:

D_T + D_H
= 2 × SamePercentage - 100
= SamePercentage - DiffPercentage

Their sum is the overall balance between persistence and alternation.

Subtracting them gives:

D_T - D_H
= TailsPercentage - HeadsPercentage

Their difference is the ordinary value imbalance, viewed from the opposite direction.

The two directional measurements therefore form a small coordinate system:

  • Their sum describes Same versus Different.
  • Their difference describes Tails versus Heads.

This is more than a numerical coincidence. It shows that the value-space and relation-space descriptions of a binary stream are algebraically intertwined. The directional transition balances sit between them.

Why ClassicMetaGuess Is a Natural Probe

TruthInTheFlip does not only record Heads and Tails. Its central experiments anticipate the relation between flips.

ClassicMetaGuess observes whether the most recent transition was Same or Different and anticipates the opposite relation next:

Same      → anticipate Different
Different → anticipate Same

Its opposite, AntiMetaGuess, anticipates continuation in the relation stream:

Same      → anticipate Same
Different → anticipate Different

These two strategies are nearly ideal instruments for this subject because neither gives Heads or Tails a privileged role. If every Head in a stream were renamed Tail and every Tail renamed Head, its Same/Different relations would remain unchanged, and both strategies would make the same relational choices.

ClassicMetaGuess probes alternation in the relation stream. AntiMetaGuess probes persistence in that stream. They are complementary views of whether Same tends to follow Different and whether a relation tends to repeat itself.

The new directional metrics ask a different but adjacent question:

How is the observed Same/Different balance distributed across transitions beginning with Heads and transitions beginning with Tails?

The strategy and the metric should therefore not be collapsed into one idea. The anticipation strategy is an active rule that selects a relation for the next flip. The directional balance is a descriptive property reconstructed from the outcomes. One acts; the other measures.

Their relationship is valuable precisely because they remain distinct. A relation-symmetric strategy can be compared with source measurements that reveal whether its apparent behavior was carried equally by both sides of the binary alphabet.

Exploring Quant.tkr with TruthInTheFlip Farm

The archived Quant.tkr record gives us a concrete source for exploring these identities. A rolling window keeps the measurement local while absTotal preserves the position in the full experiment.

The Tail Continuation Balance can be emitted with:

offset#SamePercentage,negate#HeadsPercentage

The Head Continuation Balance is:

offset#SamePercentage,negate#TailsPercentage

A Farm command for both is:

csv tracker window by_total 100B file "Quant.tkr" absTotal SamePercentage HeadsPercentage TailsPercentage offset#SamePercentage,negate#HeadsPercentage offset#SamePercentage,negate#TailsPercentage

The overall Same/Different balance reconstructed from the pair is:

scale#offset50#SamePercentage,2

That produces:

2 × (SamePercentage - 50)
= SamePercentage - DiffPercentage

A broader export can place the reconstructed geometry beside the anticipation record:

csv tracker window by_total 100B file "Quant.tkr" absTotal AnticipatedPercentage ZScore SamePercentage HeadsPercentage offset#SamePercentage,negate#HeadsPercentage offset#SamePercentage,negate#TailsPercentage scale#offset50#SamePercentage,2

This does not claim that a contemporaneous source balance caused the anticipation result. It puts the two trajectories in a common record so their shape, settlement and possible relationships can be examined.

A Standardized Directional Score

The same cancellation can be expressed through the existing Z-scores. Because ZScoreSame and ZScoreHeads use the same sample total and the same 50 percent reference:

ZScoreSame - ZScoreHeads

is proportional to TT - TH. However, simply subtracting two Z-scores does not automatically produce another correctly scaled Z-score. They are derived from the same transitions and are therefore correlated.

Under an independent fair-source model, a naturally scaled Tail-directional score is:

(ZScoreSame - ZScoreHeads) / sqrt(2)

The corresponding Farm expression is:

scale#offset#ZScoreSame,negate#ZScoreHeads,0.7071067811865476

The Heads-side mirror is:

scale#offset#ZScoreSame,negate#ZScoreTails,0.7071067811865476

These scores make directional behavior more comparable across sample sizes. They should still be introduced with care: their interpretation depends on the fair independent null and on the tracker’s counting boundaries.

The Boundary Quirk

The raw identities are exact because SamePercentage, HeadsPercentage and TailsPercentage are calculated over the same counted observations.

A conditional question requires an additional step:

P(T after T) - P(H after T)

The raw Tail Continuation Balance can be written as:

P(previous T) × [P(T after T) - P(H after T)]

Dividing by the proportion of preceding Tails would remove the weighting. However, the tracker directly exposes the distribution of current Heads and Tails, not a separate count of the prior values participating in the recorded transitions.

Those distributions can differ at the two endpoints of a finite interval. At billions of flips the numerical difference is vanishingly small, but it is still a conceptual distinction. The raw balance is exact; a conditional version using TailsPercentage as its denominator is an extremely close finite-window approximation.

Relating the Source to Strategy Selection

TruthInTheFlip also records how often a strategy selected Same and how often that choice succeeded. This permits a second family of comparisons.

The strategy’s Same-selection posture is:

BetSamePercentage - SamePercentage

In Farm form:

offset#BetSamePercentage,negate#SamePercentage

This asks whether the strategy selected Same more often than Same actually occurred. It describes the strategy’s posture, not its accuracy.

A more performance-oriented quantity is Same Selection Lift:

BetSameWinRate - SamePercentage

In Farm form:

offset#BetSameWinRate,negate#SamePercentage

A positive value says that Same occurred more frequently among the conditions where the strategy selected Same than it did across the window as a whole. The Different-side mirror is:

offset#BetDiffWinRate,negate#DiffPercentage

These measurements become especially relevant to strategies such as BetSamePersistence2. That experiment uses an independent inner anticipation record to decide whether the next outer window should favor Same or Different. Selection Lift can help distinguish merely choosing the locally common side from identifying conditions where that choice performed better than the window’s general baseline.

What the Subtraction Is Saying

The original expression now has several compatible readings:

SamePercentage - HeadsPercentage
= TT - TH
= weighted Tail-conditioned persistence
= one directional component of Same versus Different

Its greatest value may be conceptual. Heads/Tails and Same/Different are often treated as separate summaries. Yet when their percentages are placed in the same algebra, they reveal the directional transitions hidden underneath.

ClassicMetaGuess and AntiMetaGuess approach the stream from relation-space without preferring either value. The new balances approach it from the transition table and recover the contribution of each starting value. Together they provide a layered view:

  1. The source produces Heads and Tails.
  2. Consecutive values produce Same and Different.
  3. An anticipation strategy acts on that relation stream.
  4. Directional balances reveal where the observed relational structure was carried.

Nothing new has been inserted into the record. The information was already present. The subtraction simply gives it a name and a place from which it can be seen.

github.com/johnwaynecornell/TruthInTheFlip

The Complex Geometry of Time: From Neolithic Benches to Imaginary Futures

If you map human progress on a standard, linear timeline, it is visually useless. 99.9% of the graph is an empty line of hunter-gatherers, and absolutely everything we consider “modern technology” is crammed into a microscopic sliver on the far right edge.

But, as geeks know, when you have data spanning massively different magnitudes, you switch to a logarithmic scale. If we plot the timeline where the x-axis represents log10(years ago), the picture changes entirely:

  • 10^6 (1,000,000 years ago): Control of fire and early stone tools.
  • 10^5 (100,000 years ago): Emergence of modern human language.
  • 10^4 (10,000 years ago): The Agricultural Revolution and the invention of the bench.
  • 10^3 (1,000 years ago): The printing press and the Renaissance.
  • 10^2 (100 years ago): Harnessing electricity and flight.
  • 10^1 (10 years ago): Cloud computing and the smartphone era.
  • 10^0 (Today): Widespread generative AI and rapid code deployment.

The Discovery: The Future is Orthogonal

While the past is a solid, continuous line of real numbers, looking into the future on this scale requires us to take the logarithm of a negative number (negative “years ago”). This is algebraically impossible on a 1D number line, forcing us into complex numbers.

In Base-10, every future milestone exists exactly 1.36i units above the past on the complex plane. This means:

  1. 100 years in the future = 2 + 1.36i
  2. 1,000 years in the future = 3 + 1.36i

Importantly for the natural logarithm base e the constant is exactly πi

Here is the mathematical proof of this “complex number” theory using Euler’s formula ($e^{i\pi} = -1$):We can rewrite $-100$ as $100 \times -1$.Using logarithm rules, we split it: $\log_{10}(100) + \log_{10}(-1)$.We know $\log_{10}(100)$ is exactly $2$.To find $\log_{10}(-1)$, we use the natural log equivalence derived from Euler’s formula: $\ln(-1) = i\pi$.Using the change-of-base formula, $\log_{10}(-1) = \frac{i\pi}{\ln(10)}$.So, mathematically, 100 years in the future on this logarithmic timeline is exactly:$$2 + \frac{i\pi}{\ln(10)}$$

Mathematically, the future isn’t just “in front” of us; it is a parallel dimension floating 1.36 units away, running alongside the past but never touching it. Through a logarithmic lens, the milestones of human invention form a steady, evenly spaced progression, proving that our rate of innovation isn’t just fast—it is shifting our very geometry.

$$\log_{10}(-t) = \log_{10}(t) + \log_{10}(-1)$$

  • The $\log_{10}(t)$ part gives you the real number (the $2$ for 100 years, the $3$ for 1,000 years, the $4$ for 10,000 years).

  • The $\log_{10}(-1)$ part is the imaginary piece ($\frac{i\pi}{\ln(10)}$), which always evaluates to $1.364376… i$.