Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 1018 Bytes

connect.md

File metadata and controls

26 lines (22 loc) · 1018 Bytes

The abstract boardgame known as Hex / Polygon / CON-TAC-TIX is quite simple in rules, though complex in practice. Two players place stones on a rhombus with hexagonal fields. The player to connect his/her stones to the opposite side first wins. The four sides of the rhombus are divided between the two players (i.e. one player gets assigned a side and the side directly opposite it and the other player gets assigned the two other sides).

Your goal is to build a program that given a simple representation of a board computes the winner (or lack thereof).

The boards look like this (with spaces added for readability, which won't be in the representation passed to your code):

. O . X .
 . X X O .
  O O O X .
   . X O X O
    X O O O X

White (O) plays from top to bottom, black (X) plays from left to right. In the above example white has made a connection from left to right but nobody has won since white didn't connect top and bottom.