Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Math 24 Game

A Math24 card game developed with Python and Tkinter, currently supporting single-player mode with two-player mode to be added in future updates.

Game Introduction

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.

Features

  • 🎮 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

Installation Requirements

Runtime Environment

  • Python 3.7+
  • Tkinter(usually installed with Python)

Dependencies

pip install PyYAML
Math24Game/
├── 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

Running the Game:

  • 1.Clone the project to your local machine
  • 2.Install the required dependencies
  • 3.Run the main program

How to Play:

  • 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"

Math 24 Game designed by QuirkyBrain

Image Sources

  • Background images and buttons were generated with Doubao as a base, then individually combined and modified

Contact Information

24点

一个基于Python和Tkinter开发的24点纸牌游戏,目前仅支持单人模式,双人模式后续更新。

游戏介绍

24点游戏是一种数学益智游戏,使用扑克牌进行。玩家需要利用给定的4张牌,通过加、减、乘、除等运算得到24。

功能特性

  • 🎮 单人和双人游戏模式
  • 👤 用户注册和登录系统
  • 📊 游戏数据统计和正确率计算
  • 🎴 精美的扑克牌UI界面
  • 🧮 智能24点求解器
  • 📝 表达式验证和错误提示

安装要求

运行环境

  • Python 3.7+
  • Tkinter(通常随Python一起安装)

依赖包

pip install PyYAML
Math24Game/
├── 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.提交答案:输入数学表达式或选择"无解"

Math 24 Game designed by QuirkyBrain

联系方式

图像来源

  • 背景图像和按钮均由豆包生成基础,个人组合修改

致谢

  • 感谢所有参与测试和提供反馈的用户!

About

A Math24 card game developed with Python and Tkinter, currently supporting single-player mode with two-player mode to be added in future updates.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages