Gomoku_MCTS
:
cal_kill.py
- Kill calculation moduleconv_utils.py
- Attempt to chunk the board for input (proven ineffective, not included in the report)dueling_net.py
- DDQN network implementationgame.py
- Game record definition, basic gameplay framework, and manual testing codemain_worker.py
- Model training frameworkmcts_alphaZero.py
- AlphaZero implementationmcts_Gumbel_Muzero
- Gumbel_MuZero implementationmcts_pure.py
- Pure MCST codepolicy_value_net_pytorch_new.py
- Policy value network (unclear purpose)policy_value_pytorch.py
- Policy value networkscripts
: Scripts for testing codevisualization
: Folder for tensorboard logscheckpoint
: Trained model parametersconfig
: Basic training configuration
Gomoku-Bot
:
test/
- Testing scriptsboard.py
- Board informationcache.py
- Cache classeval.py
- Evaluation functiongomoku_bot.py
- Main file, aligned withGomoku_MCTS
interfaceminimax.py
- Alpha-beta pruning implementationposition.py
- Functions for computing board position informationshape.py
- Patterns for scoring based on board situationszobrist.py
- Zobrist hashing implementation
generate_data
:
text_files
: Contains Gomoku manager and agent scripts and 1000 opening game recordscrawl_new.py
: Script for scraping opening game recordsgenerate_better_data.py
,generate_better_data_avoid_down.py
,generate_data.py
: Scripts for generating data with Gomoku managerGomoku_MCTS_filter
: For sorting data based on win/lossrun_gomocu_manager.bat
: Batch script for data generation, invoked bygenerate_data.py
100_thousand_final
: Dataset of 100,000 board positions
cd scripts
./first_stage_training.sh
cd scripts
./second_stage_self_training.sh
preload_model
should be from Stage 1.
cd scripts
./third_stage_training.sh
preload_model
should be from Stage 2.
To scrape opening game records from "Lijin Continuum Classroom":
# Setup: Install third-party libraries
pip install beautifulsoup4
pip install selenium
# Setup: Download ChromeDriver and modify the path in the code
chrome_driver_path = 'D:\\Program_File\\googledrive\\chromedriver.exe'
# Modify the following number based on the webpage count of the game records
N_page = 5
# Target URL (modify accordingly)
url = f'<https://www.ljrenju.com/news/cnjsu2022/zhesp2022r{i}.htm>'
# Run command
python generate_data/crawler_new.py
Setting up the Bot for gameplay to generate data:
# Run command
python generate_data/generate_better_data.py
# Note: This script involves running a .bat file, so it only works on Windows.
# For other systems, convert the generate/run_gomocu_manager.bat to an equivalent bash file.
# Setup: Download Gomoku Manager and several Bots
# Modify the parameters in generate/generate_better_data.py
# [ENV] Download piskvork.exe from https://gomocup.org/download/ and set the path
pis_root = r"D:\\Program_File\\piskvork\\piskvork_win_lose"
# [ENV] Folder containing the Bots
ai_root = r"D:\\Program_File\\piskvork\\other_agent"
# [CHANGE] Folder for saving the output data
out_file = "100_thousand_after\\\\out_better" + str(cnt) + ".txt"