GithubHelp home page GithubHelp logo

xiazhbo / sheepsolver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from biechuyangwang/sheepsolver

0.0 0.0 0.0 476 KB

《羊了个羊》解题算法 添加地图解析

License: GNU Affero General Public License v3.0

Python 100.00%

sheepsolver's Introduction

SheepSolver

本项目主要用于计算《羊了个羊》小游戏的解题步骤
正版项目开源地址为: https://github.com/NB-Dragon/SheepSolver

项目公示

算法的解题思路为回溯算法,尝试解决的NP问题为:是否存在一个解使得游戏通关
从代码逻辑中体现为卡牌的抽取顺序,不同的抽取方式将决定能否在短时间内得到答案
不保证在短时间内计算出答案,如果解题时间超过5分钟,建议放弃挑战并重新开始
本项目的实现方案为无道具,如需其他定制功能,请联系QQ号: 851870763

使用教程

部署当前项目

git clone https://github.com/NB-Dragon/SheepSolver.git
cd SheepSolver && pip install -r requirements.txt

安装抓包程序的依赖组件: nodejs

官方安装指导手册: 官方链接

# Debian and Ubuntu based Linux distributions
sudo apt install nodejs

启动mitmdump程序

# 启动无交互功能的抓包程序
mitmweb -p 7777 -s capture.py

把证书文件保存到终端设备

  • 方法1: 终端设备设置代理后,访问该链接下载证书文件: http://mitm.it
  • 方法2: 将mitmproxy的证书文件直接拷贝到终端设备

终端设备添加证书信任

受限于文档篇幅,请自行查阅资料,添加证书信任,这里不再展开说明

获取游戏地图数据

  • 按照上述步骤提示启动mitmdump程序
  • 打开微信小程序并进入游戏界面
  • 注意此时本项目根路径下的online_data.json文件会更新

求解答案和提交答案

  • 打开终端并进入到本项目的根路径
  • 执行命令python solve.py -m normal
  • 等到结果成功打印出来后,根据自身需求选择答案格式

倒数第二行的结果为卡牌的编号,可用于在第三方项目中显示操作步骤

算法的选择

本算法目前提供六种选牌方式,可在脚本的启动参数中进行修改

  • normal: 默认模式,该模式下取牌顺序由程序进度决定
  • index: 序号顺序模式,该模式下取牌顺序由初始化阶段的序号决定
  • index-reverse: 序号逆序模式,该模式下取牌顺序由初始化阶段的序号决定
  • level-bottom: 底层优先模式,该模式下取牌顺序由卡牌的层数决定
  • level-top: 高层优先模式,该模式下取牌顺序由卡牌的层数决定
  • random: 随机模式,该模式下取牌顺序完全随机,祝各位好运

配置说明

  • show_progress: 是否需要显示实时求解进度(布尔值)
  • solve_first: 优先消除策略的启动时机(百分比)
  • time_limit: 程序最长运行时间(秒),小于0则无限制
  • expect_progress: 在指定时间内达到指定进度则继续求解

特别鸣谢

许可证

GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007

sheepsolver's People

Contributors

nb-dragon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.