# How does the guard in Prince of Persia know when to block?

- Series: [How It Spawns](https://miu.fm/howitspawns.md)
- Premieres: 2026-12-02
- Page: https://miu.fm/howitspawns/how-does-the-guard-in-prince-of-persia-know-when-to-block

## Story

How does the guard in Prince of Persia know when to block?

In the 1989 Apple II original, a guard doesn't move himself. Jordan Mechner's code only pushes a joystick and a button for him, and the same control code that moves you moves him.

He reads your sword one frame ahead. Every drawing of your swing has a number, and when your next one is 152, he picks a number from 0 to 255. If it's under his block number, he blocks. The first guards' number is 0: they never block. Level 2's first guard has 150. The grand vizier has 255, so one swing in 256 gets through.

Block his strike, though, and the code says "impair my blocking ability for a while": for four frames he rolls against a lower number, 145 for the vizier. A strike straight out of your block meets that number. Block first, then strike.

Mechner never meant his prince to fight. By June 1988 the Apple II's memory was full, until he found 12K hiding on a memory card, enough to add a guard. His little brother David, filmed at 15 for the running and jumping, wasn't any good at sword fighting, as Mechner tells it, so the sword moves came from about six seconds of the 1938 Robin Hood duel, photographed frame by frame.

The palace, the figures and the fights are our own simplified version, drawn in code; the numbers are read from the released source.

Which guard took you the most tries?

Sources: Jordan Mechner, Prince of Persia Apple II source code (1989, released 2012, github.com/jmechner/Prince-of-Persia-Apple-II); Jordan Mechner on Ars Technica's War Stories (2020); Mechner's Prince of Persia Technical Information (1989); jordanmechner.com.
Not an official Ubisoft video. Not approved by or associated with Ubisoft.
Sounds and music: our own, made in code.

## Follow

- TikTok: https://www.tiktok.com/@howitspawns
- Instagram: https://www.instagram.com/howitspawns/
- YouTube: https://www.youtube.com/@howitspawns
- X: https://x.com/howitspawns

---

Under copyright law, a quotation must name its source: Miuradio, https://miu.fm/howitspawns/how-does-the-guard-in-prince-of-persia-know-when-to-block

© 2026 Miuradio, https://miuradio.com
