Eaten Go Stones

Eaten Go Stones

English RU

A quite unbelievable event has occurred several years ago, in the spring of 2016 - the computer program AlphaGo , developed by Google DeepMind, won against the world's best player in the Go game with the result 4-1. Until the very last moment nobody believed that the computer can beat a man in the ancient Japanese game, in which the quantity of possible variants is greater than the number of atoms in the whole Universe!

Unlike chess, where every player from the very beginning of the game has the full set of figures on the 8x8 board, and can analyse all moves just by using the estimation strategy, the Go game requires very different skills. First of all, this game uses the board which is almost 6 times greater than the chessboard - 361 game points against only 64 in chess. Secondly, the game begins with an absolutely empty board and till the middle of it your success is based strictly on your intuition and the sense of the harmonious placement of stones.
Regardless, due to the machine learning and the huge number of games AlphaGo has played with itself, the program became stronger than a man.

In this mission you'll learn how to analyze the board situation along with the basic rules of the Go game. Here are some of them:
- 2 men play with stones (game figures) of different colors;
- the stones are put on the intersections;
- every stone or the group of stones has a certain degree of freedom or 'liberties' - dame (traditional Japanese word for this term). These are the points which contact with the stone/group horizontally and vertically;
- the whole group is a group of stones that contact with each other horizontally and vertically. The group has mutual 'liberties';
- if all 'liberties' of the stone or the group are blocked/closed by the stones of the other player - these stones are being "eaten" and removed from the board.
Here is a demonstration of the 'liberties' concept.


In this mission your task is to count how many stones of each color have been 'eaten'. The input will be a two-dimensional array - the list of the strings, where the empty intersections will be '+', the black stones - 'B' and the white stones - 'W' (black & white are the traditional colors for this game). You should return the answer in the dictionary format, like this: {'B': n, 'W': m}, where n and m are the amount of black and white stones which have been 'eaten'. For example, if there have been eaten 3 black stones, and 4 white, the answer will be: {'B': 3, 'W': 4}.


Input: A two-dimensional array (the list of the strings).

Output: Dictionary with the amount of the 'eaten' stones of each color.


         '+++++B+++']) == {'B': 3, 'W': 4}

How it is used: For game AI development and game analysis.

Precondition :
Board - 9х9, 7x7, 5x5

Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission