[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Megazeux and the Loop-Killer



While reading about Croquet, a trippy collaborative 3D environment, I
came across a phrase describing how to prevent programs from (obvious
kinds of) looping: "temporal tail recursion."

You've played that "snake" game, right? You steer the head of a snake,
dragging a long tail behind it to mark where it's been lately. If the
head ever touches the tail, it dies. So, as long as you have a system
that runs code line-by-line, you could just track the last N line
numbers that've been called to identify and break out of tight,
accidental loops.

Kris