Skip to main content

hit-and-blow

Switch游戏 - 猜颜色 自动解算器。

猜颜色是《世界游戏大全51》中的一款小游戏。本仓库复现了该游戏的玩法,并添加了“自动解算”功能。

Functions

已支持四种模式:

  • 游戏模式 (game.py):复现基本功能,可在命令行体验游戏玩法
  • 自动解算 (auto_play.py):计算答案的可行域,使用寻优策略逐步逼近答案
  • 实验模式 (experiment.py):多次重复自动解算过程,用于统计寻优策略的性能
  • 作弊模式 (hacker.py):和朋友联机时获得指引,快人一步得出答案 ( `д´)

Usage

可通过两种方式运行代码:

1)通过 pypi 下载运行

import switch_hacker

g = switch_hacker.game.Game()
g.main()

2)本地运行:以作弊模式为例

  1. 在 src 目录下新建 hack.py 文件
  2. 将以下代码贴入文件中保存
  3. 在命令行中执行 python hack.py
# hack.py
import switch_hacker

hk = switch_hacker.hacker.Hacker()
hk.main()

Tree

文件结构

├── README.md
├── pyproject.toml
└── src
    ├── switch_hacker
    │   ├── __init__.py
    │   ├── base.py: 通用函数集合
    │   ├── game.py: 命令行游戏
    │   ├── auto_play.py: 自动解算器
    │   ├── experiment.py: 实验统计模块
    │   ├── hacker.py: 作弊模块
    │   └── strategy.py: 寻优策略
    └── test
        └── example.py: 示例代码

Log

  • 命令行游戏
  • 自动解算器
  • 实验统计模块
  • 作弊模块
  • 强化学习

Appendix

游戏的命令行实现:

游戏的命令行实现.gif

Metadata

Release files for switch-hacker 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for switch-hacker 0.0.1
File Size Uploaded
switch_hacker-0.0.1.tar.gz 261.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for switch-hacker 0.0.1
File Interpreter ABI Platform
switch_hacker-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 271.6 kB

Release files / switch_hacker-0.0.1.tar.gz

Download URL switch_hacker-0.0.1.tar.gz
Size 261.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6d512dd36a6f1a0753fbf53907859525f77702f752e7883d2f6956b8743627a8
BLAKE2b-256 checksum
How to use checksums
419761d7d8c40bb183d88df35c2484b477dccb2c9544d0b99a3e7390824c090d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / switch_hacker-0.0.1-py3-none-any.whl

Download URL switch_hacker-0.0.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94176cc1e13cf7392228627e18843ce3ca8f6a371b428fa57cacbbf4578c63dc
BLAKE2b-256 checksum
How to use checksums
f8e0aef30785b97288b357de12432df8753fc601ed0090ffb12dcfca906babfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page