Coder Social home page Coder Social logo

loveberryc / cchess-zero Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chengstone/cchess-zero

0.0 0.0 0.0 3.28 MB

AlphaZero implemented Chinese chess. AlphaGo Zero / AlphaZero实践项目,实现**象棋。

License: MIT License

Python 60.24% Jupyter Notebook 39.76%

cchess-zero's Introduction

cchess-zero

AlphaZero implemented Chinese chess. AlphaGo Zero / AlphaZero实践项目,实现**象棋。

Author chengstone

e-Mail [email protected]

代码详解请参见文内jupyter notebook和↓↓↓

知乎专栏:https://zhuanlan.zhihu.com/p/34433581

博客:http://blog.csdn.net/chengcheng1394/article/details/79526474

欢迎转发扩散 ^_^

这是一个AlphaZero的实践项目,实现了一个**象棋程序,使用TensorFlow1.0和Python 3.5开发,还要安装uvloop。

因为我的模型训练的不充分,只训练了不到4K次,模型刚刚学会用象和士防守,总之仍然下棋很烂。

如果您有条件可以再多训练试试,我自从收到信用卡扣款400美元通知以后就把aws下线了:D 贫穷限制了我的想象力O(∩_∩)O

我训练的模型文件下载地址:https://pan.baidu.com/s/1dLvxFFpeWZK-aZ2Koewrvg

解压后放到项目根目录下即可,文件夹名叫做gpu_models

现在介绍下命令如何使用:

命令分为两类,一类是训练,一类是下棋。

训练专用:

  • --mode 指定是训练(train)还是下棋(play),默认是训练
  • --train_playout 指定MCTS的模拟次数,论文中是1600,我做训练时使用1200
  • --batch_size 指定训练数据达到多少时开始训练,默认512
  • --search_threads 指定执行MCTS时的线程个数,默认16
  • --processor 指定是使用cpu还是gpu,默认是cpu
  • --num_gpus 指定gpu的个数,默认是1
  • --res_block_nums 指定残差块的层数,论文中是19或39层,我默认是7

下棋专用:

  • --ai_count 指定ai的个数,1是人机对战,2是看两个ai下棋
  • --ai_function 指定ai的下棋方法,是思考(mcts,会慢),还是直觉(net,下棋快)
  • --play_playout 指定ai进行MCTS的模拟次数
  • --delay和--end_delay默认就好,两个ai下棋太快,就不知道俩ai怎么下的了:)
  • --human_color 指定人类棋手的颜色,w是先手,b是后手

训练命令举例:

python main.py --mode train --train_playout 1200 --batch_size 512 --search_threads 16 --processor gpu --num_gpus 2 --res_block_nums 7

下棋命令举例:

python main.py --mode play --ai_count 1 --ai_function mcts --play_playout 1200 --human_color w

许可

Licensed under the MIT License with the 996ICU License.

cchess-zero's People

Contributors

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