Skip to content
/ Qt-Gomoku Public

A Gomoku developed with Qt. 一個基於Qt開發的五子棋

License

Notifications You must be signed in to change notification settings

SXKA/Qt-Gomoku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qt-Gomoku

EN ZH

Free-style Gomoku rule.

Detail: https://github.com/SXKA/Qt-Gomoku/wiki (Traditional Chinese)

Usage

Include src/search/engine.h to use search engine.

// Create a engine.
Search::Engine engine;

// Set search parameters.
Search::LIMIT_DEPTH = depth; // Extensions will not be limited.
Search::MC_C = mc_c; // Multi-Cut number of cutoffs.
Search::MC_M = mc_m; // Multi-Cut number of moves.
Search::MC_R = mc_r; // Multi-Cut depth reduction.
Search::R = r;       // Null move pruning depth reduction.

// Make a move for black.
engine.move({7, 7}, Black);

// Search for the best move for white.
const auto bestMove = engine.bestMove(White);

// Check the best move is legal. (Engine::bestMove return should be legal.)
const auto legal = Search::Engine::isLegal(bestMove);

if (legal) {
    // Make a move for white.
    engine.move(bestMove, White);
}

// Get Gomoku game status.
const auto status = engine.gameStatus(bestMove, White);

// Determine whether to continue the game based on the status.
switch (status) {
    case Draw:
        // Dealing with draw and don't continue use the engine.
        break;
    case Undecided:
        // Continue the game.
        break;
    case Win:
        // Dealing with White's victory and don't continue use the engine.
        break;
}

// Undo a move. Please make sure there are moves that can be undo.
engine.undo(1);

Requirements

  • Qt 6.5.2

References

Features

  • Using async way to search to avoid main thread blocking.
  • Searching depth reaches 12 ply.
  • Principal Variation Search (PVS)
  • Transposition table
  • Null Move Pruning
  • Multi-Cut
  • Extensions

Homepage

image

Game UI