Crypt
Arithmetic
Solver
AI-powered CSP engine with backtracking search [made by Team 3 (AM2)]
Use uppercase letters. Supports + and - operators. One = sign required.
Play
Mode
Guess the digit mappings before the AI does
Select a puzzle above to start playing!
How It
Works
The AI concepts behind the solver
What is Crypt Arithmetic?
Crypt Arithmetic is a type of mathematical puzzle where digits are replaced by letters. Each letter represents a unique digit (0โ9), and the goal is to find an assignment that makes the arithmetic equation valid.
S E N D
+ M O R E
โโโโโโโโโ
M O N E Y
The classic SEND+MORE=MONEY has a unique solution: S=9, E=5, N=6, D=7, M=1, O=0, R=8, Y=2.
Constraint Satisfaction Problem (CSP)
A CSP is defined by three components:
- Variables โ each unique letter in the puzzle
- Domain โ digits 0โ9 for each variable
- Constraints โ all-different digits, no leading zeros, equation must hold
The solver narrows down possibilities by propagating constraints before and during search, dramatically reducing the search space compared to brute force.
Backtracking Algorithm
Backtracking is a depth-first search with pruning. It works like this:
- Pick the next unassigned letter
- Try each digit in its domain
- Check if constraints are still satisfied
- If yes โ recurse deeper; if no โ backtrack
- Continue until all letters are assigned (solution!) or all options exhausted (no solution)
10! = 3,628,800 iterations
With pruning: often solved in < 1,000
Optimizations Used
- Constraint Propagation โ eliminate impossible values early
- Most Constrained Variable (MCV) โ assign letters in order of appearance to enable early failure detection
- Forward Checking โ verify partial assignments satisfy column-wise carry constraints
- Leading Zero Pruning โ immediately reject any assignment that puts 0 on a leading letter