A Math24 card game developed with Python and Tkinter, currently supporting single-player mode with two-player mode to be added in future updates.
The 24 Game is a mathematical puzzle game played with playing cards. Players need to use the four given cards and operations like addition, subtraction, multiplication, and division to obtain the number 24.
- 🎮 Single and two-player game modes
- 👤 User registration and login system
- 📊 Game statistics and accuracy calculation
- 🎴 Beautiful playing card UI interface
- 🧮 Smart 24-point solver
- 📝 Expression validation and error prompts
- Python 3.7+
- Tkinter(usually installed with Python)
pip install PyYAMLMath24Game/
├── src/
│ ├── Config/ # Configuration files
│ │ ├── player.py
│ │ ├── yamlhandler.py
│ │ ├── BaseImagePath.yaml
│ │ ├── CardsImagePath.yaml
│ │ └── UserConfig.yaml
│ ├── Controls/ # Custom UI controls
│ │ ├── c_button.py
│ │ ├── c_canvas.py
│ │ └── c_label.py
│ ├── Core/ # Core game logic
│ │ ├── shuffle.py
│ │ └── solve24.py
│ └── UI/ # User interface
│ ├── main.py # Program entry
│ ├── login_page.py
│ ├── single_player_page.py
│ ├── two_player_page.py
│ ├── rule_page.py
│ └── setting_page.py
├── resources/ # Resource files
│ └── image/ # Image resources
│ ├── Button/
│ │ ├── Bg/
│ │ └── Fg/
│ ├── Cards/
│ │ ├── Back/
│ │ ├── Bg/
│ │ ├── Club/
│ │ ├── Diamond/
│ │ ├── Heart/
│ │ ├── Spade/
│ │ └── Joker/
│ ├── GameBackground/
│ ├── Icon/
│ ├── Login/
│ ├── Rule/
│ ├── Toplevel_sign/
│ └── Player/
│ ├── Accuracy_bg/
│ └── Avatar/
└── README.md
- 1.Clone the project to your local machine
- 2.Install the required dependencies
- 3.Run the main program
- 1.Register/Login: First-time users need to register an account
- 2.Select Mode: Single-player practice
- 3.Start Game: The system deals 4 cards, use addition, subtraction, multiplication, and division to get 24
- 4.Submit Answer: Enter a mathematical expression or select "No Solution"
- Background images and buttons were generated with Doubao as a base, then individually combined and modified
- Email:haoxuanzhang@mail.nwpu.edu.cn or 403723093@qq.com
- Thanks to all users who participated in testing and provided feedback!
一个基于Python和Tkinter开发的24点纸牌游戏,目前仅支持单人模式,双人模式后续更新。
24点游戏是一种数学益智游戏,使用扑克牌进行。玩家需要利用给定的4张牌,通过加、减、乘、除等运算得到24。
- 🎮 单人和双人游戏模式
- 👤 用户注册和登录系统
- 📊 游戏数据统计和正确率计算
- 🎴 精美的扑克牌UI界面
- 🧮 智能24点求解器
- 📝 表达式验证和错误提示
- Python 3.7+
- Tkinter(通常随Python一起安装)
pip install PyYAMLMath24Game/
├── src/
│ ├── Config/ # 配置文件
│ │ ├── player.py
│ │ ├── yamlhandler.py
│ │ ├── BaseImagePath.yaml
│ │ ├── CardsImagePath.yaml
│ │ └── UserConfig.yaml
│ ├── Controls/ # 自定义UI控件
│ │ ├── c_button.py
│ │ ├── c_canvas.py
│ │ └── c_label.py
│ ├── Core/ # 核心游戏逻辑
│ │ ├── shuffle.py
│ │ └── solve24.py
│ └── UI/ # 用户界面
│ ├── main.py # 程序入口
│ ├── login_page.py
│ ├── single_player_page.py
│ ├── two_player_page.py
│ ├── rule_page.py
│ └── setting_page.py
├── resources/ # 资源文件
│ └── image/ # 图片资源
│ ├── Button/
│ │ ├── Bg/
│ │ └── Fg/
│ ├── Cards/
│ │ ├── Back/
│ │ ├── Bg/
│ │ ├── Club/
│ │ ├── Diamond/
│ │ ├── Heart/
│ │ ├── Spade/
│ │ └── Joker/
│ ├── GameBackground/
│ ├── Icon/
│ ├── Login/
│ ├── Rule/
│ ├── Toplevel_sign/
│ └── Player/
│ ├── Accuracy_bg/
│ └── Avatar/
└── README.md
- 1.克隆项目到本地
- 2.安装依赖包
- 3.运行主程序
- 1.注册/登录:首次使用需要注册账号
- 2.选择模式:单人练习
- 3.开始游戏:系统发4张牌,使用加减乘除得到24
- 4.提交答案:输入数学表达式或选择"无解"
- 背景图像和按钮均由豆包生成基础,个人组合修改
- 感谢所有参与测试和提供反馈的用户!