Sha256: 7592f04ddb422d0bc73239b38a5a6e20d59e28c79d5d8c86d1966c12de714eca

Contents?: true

Size: 1.03 KB

Versions: 174

Compression:

Stored size: 1.03 KB

Contents

In the game of go (also known as baduk, igo, cờ vây and wéiqí) points
are gained by completely encircling empty intersections with your
stones. The encircled intersections of a player are known as its
territory.

Write a function that determines the territory of each player. You may
assume that any stones that have been stranded in enemy territory have
already been taken off the board.

Multiple empty intersections may be encircled at once and for encircling
only horizontal and vertical neighbours count. In the following diagram
the stones which matter are marked "O" and the stones that don't are
marked "I" (ignored).  Empty spaces represent empty intersections.

```
+----+
|IOOI|
|O  O|
|O OI|
|IOI |
+----+
```

To be more precise an empty intersection is part of a player's territory
if all of its neighbours are either stones of that player or empty
intersections that are part of that player's territory.

For more information see
[wikipedia](https://en.wikipedia.org/wiki/Go_%28game%29) or [Sensei's
Library](http://senseis.xmp.net/).

Version data entries

174 entries across 174 versions & 1 rubygems

Version Path
trackler-2.1.0.18 common/exercises/go-counting/description.md
trackler-2.1.0.17 common/exercises/go-counting/description.md
trackler-2.1.0.16 common/exercises/go-counting/description.md
trackler-2.1.0.15 common/exercises/go-counting/description.md
trackler-2.1.0.14 common/exercises/go-counting/description.md
trackler-2.1.0.13 common/exercises/go-counting/description.md
trackler-2.1.0.12 common/exercises/go-counting/description.md
trackler-2.1.0.11 common/exercises/go-counting/description.md
trackler-2.1.0.10 common/exercises/go-counting/description.md
trackler-2.1.0.9 common/exercises/go-counting/description.md
trackler-2.1.0.8 common/exercises/go-counting/description.md
trackler-2.1.0.7 common/exercises/go-counting/description.md
trackler-2.1.0.6 common/exercises/go-counting/description.md
trackler-2.1.0.5 common/exercises/go-counting/description.md
trackler-2.1.0.4 common/exercises/go-counting/description.md
trackler-2.1.0.3 common/exercises/go-counting/description.md
trackler-2.1.0.2 common/exercises/go-counting/description.md
trackler-2.1.0.1 common/exercises/go-counting/description.md
trackler-2.1.0.0 common/exercises/go-counting/description.md
trackler-2.0.8.55 common/exercises/go-counting/description.md