Code Monkey home page Code Monkey logo

joker's Introduction

斗地主残局分析器

info

项目想法来自于(欢乐)斗地主的残局模式。

下图为专家模式第 10 关

在残局模式中,玩家作为地主,先手出牌,对手是一名机器人农民,彼此明牌对局。

问,在这种情况下,如何才能赢?

usage

$ python main.py

对局开始,运行程序,输入双方手牌。

之后程序会推断玩家应该出什么牌,然后我们将相同的牌输入游戏; 同时在游戏中,机器人会打出相应的牌,然后我们要将相同的牌输入程序,以保持交互。

以专家模式的第 10 关为例,实际游戏情况(点击链接到视频):

程序运行情况(点击链接到视频):

algo

程序使用 minmax 对抗搜索算法,两人打牌完全明牌(信息共享),非输即赢(零和博弈且没有平局)。

最大手牌张数为 20 张,算法运行也没有太大压力(py 单线程加上缓存机制),所有问题分钟内可以出答案。

test

单元测试

$ python -m unittest

joker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.