https://github.com/anxingle/alphapig

Implementation of the AlphaZero algorithm for playing the simple board game Gomoku

https://github.com/anxingle/alphapig

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (4.4%) to scientific vocabulary

Keywords

alphazero gomoku
Last synced: 9 months ago · JSON representation

Repository

Implementation of the AlphaZero algorithm for playing the simple board game Gomoku

Basic Info
Statistics
  • Stars: 14
  • Watchers: 1
  • Forks: 5
  • Open Issues: 8
  • Releases: 0
Topics
alphazero gomoku
Created almost 8 years ago · Last pushed about 3 years ago
Metadata Files
Readme

README.md

AlphaPig

使用AlphaZero算法在五子棋上的实现。五子棋比围棋简单,训练起来也稍微能够简单一点,所以选择了五子棋来作为AlphaZero的复现。

参考: 1. junxiaosong/AlphaZero_Gomoku 2. starimpact/AlphaZero_Gomoku 3. yonghenglh6/GobangServer

快速启动

(确保本机安装docker/nvidia-docker) docker-compose up # (默认使用0号显卡,根据run_ai.sh 进行适配性修改)

对 run_ai.sh 进行修改后,修改docker-compose.yml:

``` version: "2.3"

services: gobangserver: image: gospelslave/alphapig:v0.1.11 entrypoint: /bin/bash runserver.sh privileged: true environment: - TZ=Asia/Shanghai volumes: - $PWD/runserver.sh:/workspace/runserver.sh # 这里修改后的映射 ports: - 8888:8888 restart: always logging: driver: json-file options: max-size: "10M" max-file: "5"

gobangai: image: gospelslave/alphapig:v0.1.11 entrypoint: /bin/bash runai.sh privileged: true environment: - TZ=Asia/Shanghai volumes: - $PWD/runai.sh:/workspace/runai.sh # 这里是修改后的映射 runtime: nvidia restart: always logging: driver: json-file options: max-size: "10M" max-file: "5" ```

上手入门

  • cd AlphaPig/sgf_data/

  • sh ./download.sh

将会下载并解压SGF棋谱数据,解压后应该实在sgfdata/目录下,目录结构AlphaPig/sgfdata/*.sgf。

也可自行下载SGF棋谱数据,并自行处理。

  • 直接运行根目录下的start_train.sh开始训练

  • 或者进入 train_mxnet.py 修改网络结构等参数,其中conf下的.yaml为训练定义的一些参数,可修改为适合自己的相关参数。

  • SGF格式详解

FF[4] SGF格式的版本号,4是最新 SZ[15] 棋盘大小,这是15x15 PW[Pig]白棋棋手名称 WR[2a]白棋棋手段位 PB[stupid]黑棋棋手名称 BR[2c]黑棋棋手段位 DT[2018-07-06]棋谱生成日期 PC[CA]棋局所在位置 KM[6.5]贴目数量 RE[B+Resign]B+是黑胜,W+是白胜,Resign是对方GG的 CA[utf-8]棋局编码 TM[0]限时情况,0为无限时 OT[]读秒规则 ;B[pp];W[dd];B[pc];W[dq] …… 棋谱下棋顺序

  • 如果需要和自己的AI对弈,可以进入evaluate目录,运行

python ChessServer.py --port 8888

既可与自己的AI进行对弈,或者与yixin对弈。详细说明请参阅evaluate目录下的ReadMe。

对弈例子:

  • 下载我训练的一些模型(还有很多bug)

cd AlphaPig/logs sh ./download_model.sh

致谢

  • 源工程请移步junxiaosong/AlphaZero_Gomoku ,特别感谢大V的很多issue和指导。

  • 特别感谢格灵深瞳提供的很多训练帮助(课程与训练资源上提供了很大支持),没有格灵深瞳的这些帮助,训练起来毫无头绪。

  • 感谢Uloud 提供的P40 AI-train服务,1256小时/实例的训练,验证了不少想法。而且最后还免单了,中间没少打扰技术支持。特别感谢他们。

Owner

  • Name: 安兴乐-siler
  • Login: anxingle
  • Kind: user
  • Location: 北京
  • Company: Infervision

Master of Computer Science, Institute of Automation of Chinese Academy of Sciences

GitHub Events

Total
  • Issues event: 1
  • Watch event: 2
  • Issue comment event: 4
Last Year
  • Issues event: 1
  • Watch event: 2
  • Issue comment event: 4

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 69
  • Total Committers: 3
  • Avg Commits per committer: 23.0
  • Development Distribution Score (DDS): 0.087
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
安兴乐 a****e@s****n 63
安兴乐-siler a****e@1****m 4
安兴乐 a****e@i****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 7
  • Total pull requests: 5
  • Average time to close issues: 24 days
  • Average time to close pull requests: about 8 hours
  • Total issue authors: 5
  • Total pull request authors: 1
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • huyp182 (3)
  • xsir317 (1)
  • initial-h (1)
  • joezou (1)
  • BryanYangZL (1)
Pull Request Authors
  • dependabot[bot] (4)
Top Labels
Issue Labels
help wanted (1)
Pull Request Labels
dependencies (4)

Dependencies

requirements.txt pypi
  • PyYAML ==5.4
  • beautifulsoup4 ==4.6.0
  • line_profiler ==2.1.2
  • numpy ==1.14.2
  • psyco *
  • requests ==2.18.4
docker-compose.yml docker
  • gospelslave/alphapig v0.1.11