Skip to main content

A Sudoku game for terminal with colorful output

Project description

Lzc - 终端数独游戏

一个运行在终端的彩色数独游戏,支持三种难度级别!

特性

  • 🎯 三种难度:简单、中等、困难
  • 🌈 彩色终端输出
  • ⌨️ 键盘控制(WASD或方向键)
  • 💡 提示功能
  • ✓ 答案检查
  • 🔄 重置/新游戏
  • 💻 跨平台支持

安装

pip install lzc

开始游戏

lzc
# 或
sudoku

操作说明

按键 功能
1-9 填入数字
0/X 清空格子
W/↑ 向上移动
S/↓ 向下移动
A/← 向左移动
D/→ 向右移动
H 获取提示
C 检查答案
R 重置游戏
N 新游戏
Q 退出

游戏目标

在 9×9 的网格中填入数字 1-9,满足:

  • 每行包含 1-9 且不重复
  • 每列包含 1-9 且不重复
  • 每个 3×3 宫格包含 1-9 且不重复

Python 代码使用

from lzc import Sudoku

# 创建游戏
game = Sudoku(difficulty='medium')

# 获取/设置格子
game.get_cell(row, col)
game.set_cell(row, col, value)

# 检查是否完成
if game.is_complete():
    print("完成!")

# 获取提示
row, col, value = game.get_hint()

截图

=====================================
        数 独 游 戏
=====================================

+-------+-------+-------+
| 5 3   |   7   |       |
| 6     | 1 9 5 |       |
|   9 8 |       |   6   |
+-------+-------+-------+
| 8     |   6   |     3 |
| 4     | 8   3 |     1 |
| 7     |   2   |     6 |
+-------+-------+-------+
|   6   |       | 2 8   |
|       | 4 1 9 |     5 |
|       |   8   |   7 9 |
+-------+-------+-------+

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lzc-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lzc-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file lzc-0.1.0.tar.gz.

File metadata

  • Download URL: lzc-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lzc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9830cf2365a6a51a6f76bd55657762dc4cda2910aed836010173771dbd698557
MD5 5b982442125c3bd9e184a3cc59cb5cc2
BLAKE2b-256 47255119d5041315097265cacd76249ed1fe9b51e35d66976e272c2b39ddcda1

See more details on using hashes here.

File details

Details for the file lzc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lzc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lzc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0867e13c9595cbb3ba465392c3f3aaef524f9d9cdb7ed4de9fecb0fcda9bb4b
MD5 8b1aa2fec0d885b99b149cc2ca33ae25
BLAKE2b-256 3e7337c6e67003edfca67769e9e3b6c0ca413e00180bbb23264f119bffe930a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page