This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
The game is played on a hexagonal board. The board does not change during the game.
Each player starts with
The coordinates of each cell are represented on the image below. White and black cells depict the initial positions of the marbles.
The players take turns, black starts.
On their turn, each player chooses from one to three marbles of their color that lie in a straight line and moves them one cell in a choosen direction. Each direction is labelled from
The marbles can be moved only into empty cells.
If the direction of the move is parallel to the line of marbles, the move is called an in-line move.
When the player's in-line move is blocked by enemy marbles, the player might sometimes apply a Sumito move.
If the length of player's marbles column is strictly longer than the number of enemy marbles in a consecutive line in that direction and after the enemy marbles' line there is an empty space or the end of the board, the player may still apply an in-line move and push the enemy marbles.
If the last marble of the pushed enemy column gets pushed out of the board, the marble is then removed.
The first player that successfuly removes six enemy marbles wins. The game lasts for
If both of the players removed the same amount of marbles, there is a draw.
An example of an in-line move made by the black player.
An example of a side-step move made by the white player.
An example of a Sumito move made by the white player (there are two white marbles blocked by only one black, white marbles can push the black marble.
An example of an another Sumito move made by the white player, who manages to remove the black's marble.
Next 9 lines: characters representing one line of the game board's grid, top to bottom. (
Next line: five integers representing your opponent's last move (see Output section for details). If this is the first turn and you're the starting player, each integer is equal to
Next line: The number of valid moves(legalActionsCount).
Next legalActionCount lines: five integers representing each of the legal moves (see Output section for details).
Example: "2 3 3 5 4" - moving marbles from cells (2, 3), (3, 4) and (3, 5) in the direction labbeled by number
Response time per turn is ≤
A higher resolution is required to access the IDE