Speedrun Optimization · Algorithmic Bruteforce

Prince of Persia Puzzle Simulators

Mathematical models and interactive solvers for Prince of Persia speedrun puzzles

A suite of state-space simulators and search algorithms created to find the absolute minimum input sequences for Prince of Persia speedruns. Play with the interactive models below or explore the underlying state machines.

Select a Puzzle Simulator

Prince of Persia: The Two Thrones · T2TKINGP.CPP

King's Statue Puzzle Simulator

In The Two Thrones, the Prince must navigate a giant statue of his father King Sharaman through the palace courtyard. Each tile on the courtyard track permits specific movements (forward/backward translation or clockwise/anti-clockwise rotation) depending on the direction the statue is facing. The puzzle is solved by moving forward from step 4 while the statue is facing Front.

Track Progress (0 → 5):
Start (0)
1
2
3
4
Exit (5)
Translational Step: 0
Facing Heading: Front
Total Moves: 0
Available Moves from this Tile:
Move History:
No moves made yet
Prince of Persia: The Forgotten Sands · TFS_WaterPillar3.CPP

Water Pillar 3 Puzzle Simulator

The Water Pillar puzzle features three stacked rotating tiers (Lower, Middle and Upper), each sitting at position 1–4. A Normal lever move turns every piece. A Freeze move holds back any piece that is at position 4 (clockwise) or position 1 (anti-clockwise); the Upper and Middle tiers each hold back together with a hidden joint piece. The puzzle is solved when all three tiers are at position 4 (the game gives no indication).

Upper Tier:
2
Middle Tier:
4
Lower Tier:
1
Rotate Levers:
Move History:
No moves made yet
The Forgotten Sands (Wii) · TFS_Wii_Gems_Simulator.CPP

Dual-Gear Gems Puzzle Simulator

A dual interlocking rotary ring puzzle from the Wii version of The Forgotten Sands. Each ring holds eight gems, and the two rings overlap in two slots, so turning one ring also changes the other. A colour is solved when the four gold-ringed slots all hold that colour or the white wildcard (5). Solve all four colours at least once to win.

Gold ring = slot checked for solving · Dashed border = slot shared by both rings · 1 Yellow, 2 Green, 3 Orange, 4 Purple, 5 Wildcard

Dial Rotations:
Move History:
No moves made yet

Speedrun Bruteforce Architecture

STATE SPACE MAPPING

Why Bruteforce?

In speedruns, solving puzzles by intuition or standard intended player routes wastes dozens of seconds. Because each move has a deterministic transition matrix, we can model the entire game puzzle as a directed graph and compute the Breadth-First Search (BFS) shortest path to discover the fastest possible inputs.

T2T STATUE CONSTRAINTS

The Two Thrones Matrix

The King's Statue puzzle uses a 2D transition table indexed by [rotation][translation]. Certain tiles block forward motion if the statue is facing the walls or dead ends, and the puzzle is only won by moving forward from step 4 while facing Front. The C++ bruteforcer searches these states and finds a shortest solution of 13 moves.

TFS PERMUTATIONS

Differential Gear Rings

The Forgotten Sands puzzles involve coupled modulo arithmetic (e.g. turn(piece, d) = (piece - 1 + d + 4) % 4 + 1) and rings that share slots. The bruteforcer runs a breadth-first search that merges identical states, so searching up to 15 moves stays fast even for the Wii gems puzzle (about 7.3 million states).

VERIFIED RESULTS

Shortest Solutions Found

T2T King's Statue 13 moves · 2 solutions
1
FWCWCWFWFWCWBWCWFWCWFWAWFW
2
AWFWAWFWFWCWBWCWFWCWFWAWFW
TFS Water Pillar 3 4 moves · 1 solution
1
FANCFANA
TFS Wii Gems 14 moves · 3 solutions
1
RALARARALARCRCLCRCLCRCLCLCRC
2
RALARARALCRCRCLARCLCRCLCLCRC
3
RALARARCRCLCRALCLCRCLALARCLC