Skip to content

ifnowcode/connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ท Connect โ€” A Strategy Game of Connection

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.


๐ŸŽฎ Gameplay Overview

  • 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


๐Ÿง  Features

  • 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


๐Ÿงฉ Rules Summary

  • 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


๐Ÿ› ๏ธ Technical Notes

  • 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


๐Ÿš€ Future Enhancements

  • Stronger AI (Monte Carlo Tree Search)

  • Move history and undo

  • Highlight winning path

  • Online multiplayer

  • Board size selection

About

Strategy game of connecting

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors