Skip to main content

A hack way to play switch game

Project description

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

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

switch_hacker-0.0.1.tar.gz (261.7 kB view details)

Uploaded Source

Built Distribution

switch_hacker-0.0.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file switch_hacker-0.0.1.tar.gz.

File metadata

  • Download URL: switch_hacker-0.0.1.tar.gz
  • Upload date:
  • Size: 261.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for switch_hacker-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6d512dd36a6f1a0753fbf53907859525f77702f752e7883d2f6956b8743627a8
MD5 05b190dda14a099dbe51ea20653b5b43
BLAKE2b-256 419761d7d8c40bb183d88df35c2484b477dccb2c9544d0b99a3e7390824c090d

See more details on using hashes here.

File details

Details for the file switch_hacker-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for switch_hacker-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94176cc1e13cf7392228627e18843ce3ca8f6a371b428fa57cacbbf4578c63dc
MD5 3cae1deed747f797bd0062267b5636d7
BLAKE2b-256 f8e0aef30785b97288b357de12432df8753fc601ed0090ffb12dcfca906babfd

See more details on using hashes here.

Supported by

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