Sha256: 51b2559f142e47fb0b9eb08c74717c7d05daa00bb7243babd5c546f401595291

Contents?: true

Size: 1.84 KB

Versions: 107

Compression:

Stored size: 1.84 KB

Contents

# Connect

Compute the result for a game of Hex / Polygon.

The abstract boardgame known as
[Hex](https://en.wikipedia.org/wiki/Hex_%28board_game%29) / 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). Note that all games need not be "fair".
(For example, players may have mismatched piece counts.)

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
```

"Player `O`" plays from top to bottom, "Player `X`" plays from left to right. In
the above example `O` has made a connection from left to right but nobody has
won since `O` didn't connect top and bottom.

## Running the tests

To run the tests run the command `go test` from within the exercise directory.

If the test suite contains benchmarks, you can run these with the `-bench`
flag:

    go test -bench .

Keep in mind that each reviewer will run benchmarks on a different machine, with
different specs, so the results from these benchmark tests may vary.

## Further information

For more detailed information about the Go track, including how to get help if
you're having trouble, please visit the exercism.io [Go language page](http://exercism.io/languages/go/about).


## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

Version data entries

107 entries across 107 versions & 1 rubygems

Version Path
trackler-2.2.1.103 tracks/go/exercises/connect/README.md
trackler-2.2.1.102 tracks/go/exercises/connect/README.md
trackler-2.2.1.101 tracks/go/exercises/connect/README.md
trackler-2.2.1.100 tracks/go/exercises/connect/README.md
trackler-2.2.1.99 tracks/go/exercises/connect/README.md
trackler-2.2.1.98 tracks/go/exercises/connect/README.md
trackler-2.2.1.97 tracks/go/exercises/connect/README.md
trackler-2.2.1.96 tracks/go/exercises/connect/README.md
trackler-2.2.1.95 tracks/go/exercises/connect/README.md
trackler-2.2.1.94 tracks/go/exercises/connect/README.md
trackler-2.2.1.93 tracks/go/exercises/connect/README.md
trackler-2.2.1.92 tracks/go/exercises/connect/README.md
trackler-2.2.1.91 tracks/go/exercises/connect/README.md
trackler-2.2.1.90 tracks/go/exercises/connect/README.md
trackler-2.2.1.89 tracks/go/exercises/connect/README.md
trackler-2.2.1.88 tracks/go/exercises/connect/README.md
trackler-2.2.1.87 tracks/go/exercises/connect/README.md
trackler-2.2.1.86 tracks/go/exercises/connect/README.md
trackler-2.2.1.85 tracks/go/exercises/connect/README.md
trackler-2.2.1.84 tracks/go/exercises/connect/README.md