Back
Close
  • 15

Statement

  The Goal

Oware, also known as Awalé, is a turn-based game, where the objective is to capture more seeds than your opponent. We're playing the Abapa variant here.

  Rules

The game is played turn by turn with two players. Each player controls one side of the board. Each side of the board contains 6 houses. The game begins with 4 seeds in each house.

Sowing

Players take turns moving the seeds. On a turn, a player chooses one of the six houses under their control. The player removes all seeds from that house, and distributes them, dropping one in each house counter-clockwise from this house, in a process called sowing. Seeds are not distributed into the house drawn from. The starting house is always left empty; if it contained 12 (or more) seeds, it is skipped, and the twelfth seed is placed in the next house.

Capturing

In Oware Abapa, capturing occurs only when a player brings the count of an opponent's house to two or three seeds with the final seed he sowed in that turn. This always captures the seeds in the corresponding house, and possibly more: If the previous-to-last seed also brought an opponent's house to two or three, these are captured as well, and so on until a house is reached which does not contain two or three seeds or does not belong to the opponent.

The captured seeds are removed from play and the player scores that many points.

However, if a move would capture all of an opponent's seeds, the capture is forfeited since this would prevent the opponent from continuing the game, and the seeds are instead left on the board.
In fact, one must always make a move that allows the opponent to continue playing. If an opponent's houses are all empty, the current player must make a move that gives the opponent seeds. If no such move is possible, the current player captures all seeds in his/her own territory, ending the game.

Victory Conditions
You have captured 25 or more seeds before the opponent. If the game exceeds 200 turns, the winner is the player with the most seeds.
Defeat Conditions
  • Your program does not provide a valid command in time.

  Game Input

Input for one game turn
Line 1: 12 space-separated integers: the number of seeds in each house. The first 6 values are always your houses.
Output for one game turn
Line 1: 1 integer between 0 and 11 (inclusive): the house played.
Constraints
Response time for first turn ≤ 1000ms
Response time for one turn ≤ 50ms
Join

A higher resolution is required to access the IDE

codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants