CSP · AI Problem Solving · Lab 4
CryptoArithmetic
Puzzle Solver
Each letter hides a unique digit. The CSP engine finds the exact mapping that satisfies your arithmetic equation.
// Enter your puzzle
Try:
SEND + MORE = MONEY
BASE + BALL = GAMES
TWO + TWO = FOUR
EAT + THAT = APPLE
GO + TO = OUT
// Equation · Solved
Time
—
Nodes explored
—
Unique letters
—
// Letter → Digit Mapping
● Gold border = leading letter (cannot be zero)
// How the CSP algorithm works
01
Extract Variables
Each unique letter becomes a CSP variable with domain 0–9 (or 1–9 for leading letters).
02
Apply Constraints
All-different constraint + the arithmetic equation must hold simultaneously.
03
Backtrack Search
Assign digits one letter at a time; prune invalid branches early via forward checking.
04
Return Solution
First valid complete assignment that satisfies every constraint is returned.