Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Gomoku is a timeless strategy board game played on a grid, where players aim to align five stones in a row to outsmart their opponent. This web-based version offers a modern design, a challenging AI, and dynamic gameplay.

License

Notifications You must be signed in to change notification settings

DevJ2K/app_gomoku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gomoku

Project Overview

πŸ“„ Overview

Gomoku is a timeless strategy board game played on a grid, where players aim to align five stones in a row to outsmart their opponent. This web-based version offers a modern design, a challenging AI, and dynamic gameplay.

πŸ“‹ Rules

The objective of Gomoku is to align five stones in a row before your opponent. To add complexity, this version includes the ability to capture your opponent's stones. You can also win by capturing five pairs of your opponent's stones.

Captures

Captures occur when you place two of your stones at both ends of exactly two of your opponent’s stones (neither one stone nor more than two stones). The captured stones are removed from the board, freeing those positions for reuse.

Example:

White stones can capture the black stones by placing a stone at the highlighted position.

Double Free Three

A "free three" is a line of three stones that can lead to a "free four"β€”a move that cannot be defended because either endpoint of the line creates a winning row of five stones. To balance gameplay, moves that create two simultaneous free threes (a "double free three") are forbidden.

βœ… Free Three:

βœ… Free Four:

❌ Double Free Three:

πŸ€– How the AI Works

The AI uses the Mini-Max Algorithm with Alpha-Beta Pruning to make strategic decisions.

Algorithm Overview

  • Mini-Max: A decision-making algorithm that simulates all possible moves to minimize the opponent's advantage while maximizing the AI's chances of winning.
  • Alpha-Beta Pruning: An optimization technique that skips evaluating branches of the decision tree that won't affect the outcome, significantly reducing computation time.

Mini-max Visualization with a Tic-Tac-Toe:

Optimization Techniques

The AI implements several optimizations for enhanced performance:

  • βœ… Alpha-Beta Pruning: Reduces unnecessary calculations.
  • βœ… Dynamic Depth Adjustment: Adjusts the search depth based on the current game state.
  • βœ… Risk-Based Action Evaluation: Focuses on moves that represent threats or opportunities.
  • βœ… Priority Sorting: Evaluates actions in order of strategic importance.
  • βœ… Efficient Game State Simulation: Saves only the move and game status instead of performing a complete deepcopy for simulations.

Try the Project - WebApp

1. Install Docker

To run this project, the first step is to install Docker on your machine. Docker simplifies deployment by providing an isolated environment for your application.

2. Install Make (Optional)

This project includes a Makefile, which allows you to execute Docker commands more easily, without having to type them manually. While using make is optional, it is highly recommended to simplify operations. You can install make by following this link or by searching for installation instructions specific to your system.

3. Run the WebApp

With Make

Run this command in your terminal:

make

This will display:

Next, run this to start the web application:
make run

Without Make

If you prefer not to use make, you can start the web application by running the following command:

docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -d

Try the Project - Script Only

Navigate to the Project Folder

You can access the project folder by using this link.

About

Gomoku is a timeless strategy board game played on a grid, where players aim to align five stones in a row to outsmart their opponent. This web-based version offers a modern design, a challenging AI, and dynamic gameplay.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •