P
PLAYROOM
HEX YOU TOP-BOTTOM AI LEFT-RIGHT

Hex • The Connection Game

Place stones. Connect your sides. You (Red): TOP ↔ BOTTOM   AI (Blue): LEFT ↔ RIGHT. No draws — one path always wins. 11×11 classic, 7×7 for mobile.

Streak
0
Best
0
Games
0
Size
11×11
Your turn — place red to connect TOP-BOTTOM

How to Play

Hex was invented by Piet Hein & John Nash. It's a pure strategy game — no luck, no draws.

  • Red (you) wins by forming a continuous chain of red stones connecting the top edge to the bottom edge.
  • Blue (AI) wins by connecting left to right.
  • On your turn, tap any empty hex. Stones never move.
  • First to connect wins immediately. Corners belong to both of their sides.
  • Board: 11×11 is tournament size. 7×7 is faster on phones (auto-selected if width < 640px).
  • AI: Simple but solid — 1) wins if it can, 2) blocks your instant win, 3) otherwise evaluates every empty cell with Dijkstra shortest-path: it minimizes its own cells-to-connect and maximizes yours (block opponent shortest path heuristic).

Red = top-bottom, Blue = left-right. That's it.

Controls

Tap / Click place stone N new Z undo H hint 7 / 1 size
AI StrategyBlock-path + Dijkstra
Win detectionBFS / Union-Find
RenderPointy-top hexes, touch friendly

Tips to Win

  • Play bridging moves — two stones with one gap (a “bridge”) are almost connected. AI hates bridges.
  • Don't hug the edge early. Center control gives more escape routes.
  • If AI commits left side, push hard on the other side to stretch its defense.
  • On 7×7, first player has a forced win with perfect play — try to find it!

About Best

Best is your longest win streak vs AI. Stored as playroom-best-hex in localStorage. Resets only when you lose.

About Hex

📁 Strategy 🎯 Difficulty: Hard ⏱️ Duration: 3–10 min ⚡ Instant Play (No Download) 📱 Desktop & Mobile

📖 How to Play & Objective

Connect opposite sides of hexagonal grid before AI.

  • Outwit computer AI by thinking 2 to 3 moves ahead.
  • Control key strategic positions and board territory.
  • Protect your critical assets while exploiting opponent vulnerabilities.

🎮 Controls Guide

💻 Desktop:
Click to select piece or column ; Enter to confirm
📱 Mobile:
Tap pieces, columns, or board cells to make moves

💡 Tips & Strategy

  • Always consider the opponent’s best counter-move before finalizing yours.
  • Control the center of the board to maximize your tactical options.
  • Maintain defensive flexibility while advancing offensive threats.