https://ifnowcode.github.io/connect
Connect is a classic two-player abstract strategy game played on a rhombus-shaped grid of hexagonal cells. The objective is simple but deeply strategic: connect your two opposite sides before your opponent connects theirs.
This implementation focuses on clarity, fast interaction, and a clean game engine suitable for experimentation, AI research, or casual play.
-
Two players: Blue and Red
-
Players take turns placing stones on empty hexes
-
Blue aims to connect the left and right sides
-
Red aims to connect the top and bottom sides
-
First player to complete an unbroken chain wins
-
Draws are impossible โ Connect always has a winner
-
Interactive hex-grid board
-
Turn-based play with clear visual feedback
-
Automatic win detection using graph/union-find connectivity
-
Optional AI opponent (simple or pluggable)
-
Clean rendering pipeline (canvas or SVG depending on version)
-
Lightweight, dependency-free codebase
-
Players alternate placing one stone per turn
-
Stones cannot be moved or removed
-
A player wins by forming a continuous path between their two assigned sides
-
No ties โ the board geometry guarantees a winner
-
Board represented as a 2D axial or offset hex coordinate system
-
Connectivity tracked using:
-
Depth-first search, or
-
Union-Find (Disjoint Set Union) for optimal performance
-
-
Rendering uses a scalable hex-grid layout
-
Input handling supports click-to-place or tap-to-place
-
Stronger AI (Monte Carlo Tree Search)
-
Move history and undo
-
Highlight winning path
-
Online multiplayer
-
Board size selection