- You connected your sides.
A higher resolution is required to access the IDE
- 7
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
The Goal
Connect your sides: if you are red, create a path that connect both red sides. If you are blue, connect blue sides.
Rules
Players alternately place a stone, on any empty cell. Once placed, a stone cannot be removed.
Board has hexagonal cells, and is rhombus shaped. It has a side length of
A path consists of a full path of adjacent stones, touching both sides of player color.
Swap move
First player has a big advantage, so to counter that, the "pie rule", or "swap" move can be invoked.
It works as follows:
- Turn 1: red (first player) places a stone
-
Turn 2: blue (second player) thinks first player's move is too strong,
he outputs
swap-pieces to steal first move - Red's first move becomes blue's first move, and is mirrored to stay equivalent (e.g. if red played near a red side, it is mirrored to go near blue side. Red a2 becomes blue b1).
- Your opponent connected his sides (thus you cannot connect yours)
- You provide invalid move (cell already played, invalid cell, trying to swap while it is not second turn)
- Your program does not provide a valid command in time.
Details
- Red plays first, then blue
- Red connects top to bottom, blue connects left to right
- Swap move can only be played by blue on turn 2, to mirror first move
- Mirror works like this: b1 becomes a2, c3 becomes c3 ([row, col] becomes [col, row])
Coordinates system
- Cell a1 is at top left
- first line is a1, b1, c1, ...
- first column is a1, a2, a3, ...
- letters are always lowercase
External resources
Game Input
Line 1: boardSize, size of the board, and
playerColor, your color,
First line: lastMove played,
Next boardSize lines: Rows of the board,
Allotted response time to output is ≤
First turn allotted time is
empty
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
r . . . . . . . . . .
. . . . . . . . . . .
. . . b . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. b . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
d5
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . r . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
Now, you removed red stone, and placed your blue stone on e4 (mirror of d5).
Story of Hex
Hex is pretty new. Created, or I should say "discovered" because the game is so simple, in 1942 by Piet Hein, and discovered again by John Nash in 1948, independently or not, we will never know.
The game is also called "Polygon", "Nash Hex", or "Con-tac-tix". The latter would make it easier to find on search engines, but... never mind.
Hex is very easy with its single rule, and allows children to play from an early age, and deep enough to be played for years, while learning new things with every game.
A higher resolution is required to access the IDE