Do you like to play Gobang?
Do you want to know how AlphaGo Zero works?
Check it out!
You can also read my Blog 🙂
View a Demo
Quick Start
To get started with AlphaGo-Zero for Gobang, simply run the following command:
python3 MetaZeta.py
Train the MCTS AI
Once you’re set up, you can go ahead and train your own AI!
Test the AI
After training, test your AI against various opponents!
Environment Requirements
- Ubuntu 18.04.6 LTS
- tensorflow-gpu==2.6.2
File Structure
Here’s a quick overview of the files included in the project:
| Filename | Type | Description |
|---|---|---|
| TreeNode.py | MCTS | MCTS nodes of the MCTS decision tree |
| MCTS.py | MCTS | Build MCTS decision tree |
| AIplayer.py | MCTS | Build an AI based on MCTS+NN |
| Board.py | Board | Store board information |
| Game.py | Board | Defines the game process for self-play and play-with-Human |
| PolicyNN.py | NN | Constructs a residual neural network |
| MetaZeta.py | Main | GUI synthesis for all parties |
How It Works (with Code Explanation)
To understand how AlphaGo-Zero functions, let’s dive into its conceptual framework using an analogy:
Imagine you are an apprentice chef learning to make a complex dish. Initially, you mimic the actions of a master chef (this represents the residual neural network). Each time you create a dish (play a game), you evaluate its taste (the outcome of the game) and adjust your technique for next time (reinforcement learning). As you practice, you develop an internal recipe book (this aligns with the MCTS). The strategic decisions you make in the kitchen are based on previous experiences and help you create a dish that can win a cooking competition (AI successfully navigating the game).
Troubleshooting
If you encounter any issues while setting up or running your AI, consider the following troubleshooting steps:
- Ensure that your environment meets all the requirements, especially the correct version of TensorFlow and Ubuntu.
- Check for any syntax errors in your Python scripts that could be causing problems.
- Refer to the documentation files linked for components like Board, Residual Neural Network, and MCTS for detailed insights.
- Monitor your GPU utilization to ensure that TensorFlow is using the GPU for better performance.
- If problems persist, reach out to the community or look for issues on the repository.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

