Skip to content

Pear0/Alphametic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alphametic

A basic alphametic solver in Rust. It only supports addition of words, but is very fast.

It will usually complete even complex puzzles in under 1.5 seconds on my computer (Intel i5-4690k).

Example 1:

Running: alphametic SEND MORE MONEY

yields:

SEND + MORE = MONEY
9567 + 1085 = 10652

Completed in 0.3974s 

Example 2:

This example shows a puzzle with the highest possible complexity (10 unique characters).

Running: alphametic AND A STRONG OFFENSE AS A GOOD DEFENSE

yields:

AND + A + STRONG + OFFENSE + AS + A + GOOD = DEFENSE
503 + 5 + 691208 + 2774064 + 56 + 5 + 8223 = 3474064

Completed in 0.9998s

Example 3:

Aditionally, It will find all possible solutions to the puzzle.

Running: alphametic FLY FLY FLY AWAY

yields:

FLY + FLY + FLY = AWAY
675 + 675 + 675 = 2025

FLY + FLY + FLY = AWAY
840 + 840 + 840 = 2520

FLY + FLY + FLY = AWAY
875 + 875 + 875 = 2625

FLY + FLY + FLY = AWAY
940 + 940 + 940 = 2820

FLY + FLY + FLY = AWAY
605 + 605 + 605 = 1815

FLY + FLY + FLY = AWAY
405 + 405 + 405 = 1215

Completed in 0.0915s