Skip to content

shiro-wang/RL_Beta_Gobang

Repository files navigation

Alpha Gobang Zero

A gobang robot based on reinforcement learning

Version v1.0 Python 3.8.6 PyTorch 1.8.1 PyQt 5.15.2 OS Win10 | Win 11

游戏界面

主要參考

  • Refer to the git
    • Add another game program (pygame) based on the referring code.
    • Using the program train.py to train another model with more times of self-playing.

Policy-Value Net

  • Network structure
    • ConvBlock × 1
    • ResidueBlock × 4
    • PolicyHead × 1
    • ValueHead × 1
  • Network visualization
模型架构

Quick start

  1. Create virtual environment:

    conda create -n Alpha_Gobang_Zero python=3.8
    conda activate Alpha_Gobang_Zero
    pip install -r requirements.txt
  2. Install PyTorch,refer to the blog for details;

  3. Start game:

    conda activate Alpha_Gobang_Zero
    python beta_gobang.py

Train model

conda activate Alpha_Gobang_Zero
python train.py

Blog

《如何使用自对弈强化学习训练一个五子棋机器人Alpha Gobang Zero》

Reference

FAQs

  • Why does the window get stuck when it is dragged?

    Because the interface background uses acrylic effect, this problem will occur for some versions of win10. There are three solutions:

    • Upgrade win10 to the latest version.
    • Uncheck the check box of Advanced system settings --> Performance --> Show window contents when dragging.
    • Turn off the option to enable acrylic background in the setting interface.
  • Why does the configuration I modified in the settings interface not take effect immediately?

    The modified configuration will take effect at the beginning of the next game.

License

MIT License

Copyright (c) 2021 Zhengzhi Huang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages