Back to browse
GitHub Repository

CasNum (Compass and straightedge Number) is a library that implements arbitrary precision arithmetic using compass and straightedge constructions. Featuring a functional modified Game Boy emulator where every ALU opcode is implemented entirely through geometric constructions.

240 starsPython

CasNum – A GameBoy ALU using only compass-&-straightedge constructions

by 0x0mer·Feb 12, 2026·1 point·0 comments

AI Analysis

●●SolidWizardryNiche GemRabbit Hole
The Take

Numbers are represented as points and arithmetic is built from five classical compass-and-straightedge constructions — addition by midpoint/doubling, multiplication via triangle similarity, and even bitwise ops implemented geometrically. There's an actual Game Boy ALU implemented this way (with a demo GIF) and a gnarly circle-intersection formula tucked into circle.py, which makes this part museum-piece, part engineering puzzle. It's delightful, slow, and clearly aimed at people who want to watch algebra get translated into geometry.

Category
Target Audience

Mathematicians, computational-geometry researchers, emulator developers, educators, and hobbyist programmers

Similar Projects