GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - eastyou/cryptarithm: 字母算式谜:解析、按列回溯求解与可打印 A4 练习纸

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
cryptarithm
cryptarithm
 
 
examples
examples
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

cryptarithm

CI License: MIT Python 3.9+

字母算式谜(alphametic):相同字母代表相同数字,不同字母代表不同数字,多位数首位不能为 0。项目提供解析、按列回溯求解与可打印 A4 练习纸。

特性

  • 支持 +、- 与两侧多个单词,例如 FORTY + TEN + TEN = SIXTY
  • 按列从右向左回溯,带进位剪枝,常见题目毫秒级出解
  • 自动校验首字母非零、数字互不相同、等式成立
  • 内置 6 道经典题,可一键生成练习纸与答案页
  • 纯标准库,零依赖,跨平台

安装

python -m pip install -e .

用法

求解:

cryptarithm solve "SEND + MORE = MONEY"
cryptarithm solve "TWO + TWO = FOUR" --all

列出内置题目:

cryptarithm list
cryptarithm list --solve

生成练习纸:

cryptarithm sheet --count 4 --seed 3 --answers -o puzzles.html
参数 说明 默认值
--count 题目数量,不能超过内置题库 4
--seed 随机种子,便于重现 无
--title 练习纸标题 字母算式谜
--answers 追加答案页 关闭
-o 输出文件 打印到终端

内置题目

算式 参考答案
SEND + MORE = MONEY 9567 + 1085 = 10652
TWO + TWO = FOUR 734 + 734 = 1468
BASE + BALL = GAMES 7483 + 7455 = 14938
EAT + THAT = APPLE 819 + 9219 = 10038
HALF + HALF = WHOLE 9802 + 9802 = 19604
ONE + ONE = TWO 231 + 231 = 462

部分题目存在多组解,答案页给出的是一组满足全部规则的解。

示例

examples/cryptarithm.html 是 4 道题的练习纸,带答案页。

测试

python -m unittest discover -s tests -v

协议

MIT © 2026 eastyou

About

字母算式谜:解析、按列回溯求解与可打印 A4 练习纸

Topics

alphameticclicryptarithmeducationmathpuzzlepythonworksheet

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.