Skip to content

Play GoBang (五子棋) with either human or ai, in a 19*19 chessboard.

License

Notifications You must be signed in to change notification settings

Junxiao-Liao/Qt-Gobang-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Gobang Game

Overview

This is a simple Gobang (Five in a Row) game implementation with AI opponent. The game rules are:

  • It's played on a 19x19 grid.
  • Two players take turns placing stones of their color (black or white) on empty intersections.
  • The first player to form an unbroken chain of 5 stones horizontally, vertically, or diagonally wins.

Features

  • Game board rendering and stone placement
  • AI opponent with simple heuristic evaluation
  • Undo moves
  • Restart game
  • Win/lose detection

Technologies

  • C++
  • Qt 6.0

Algorithms

  • DFS to check for win condition
  • Simple heuristic board evaluation for AI:
    • Score player's moves based on number of consecutive stones
    • Score AI's moves lower to allow wins
    • Add score to board positions to guide AI placement

Usage

  1. Compile and run the code in Qt Creator
  2. Click intersections to place stones
  3. Use the buttons to trigger AI move, undo, or restart
  4. First to get 5 in a row wins

Future Improvements

  • More advanced AI algorithm like Monte Carlo Tree Search
  • Multiplayer support over network
  • Configurable board size and win condition
  • Better graphics and animations

About

Play GoBang (五子棋) with either human or ai, in a 19*19 chessboard.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published