[Community Puzzle] Oware Abapa


Send your feedback or ask for help here!

Created by @_CG_Maxime,validated by @darkhorse64,@Zorg1 and @dbdr.
If you have any issues, feel free to ping them.


can a game result in a draw? As far as i understand the referee code, there is always a winner.
My simulation often runs in a situation like:

0 0 0 0 1 1
0 0 0 0 0 0

with a score of 24 for the first player and 22 for the second player. Second player at the move.
Because he cannot make a valid move (nothing what would seed something on player one fields) he gets 2 points for the two seed in his fields.
Result: 24 vs 24.

What do I do wrong?


Yes, draws are possible: https://www.codingame.com/replay/404992472
In your case, I think, the last move was by player 0, and since player 1 doesn’t have a move that would “reach” player 0, i.e. supply him with a move, the remaining seeds are collected automatically. So, player 1’s score is also 24.

Any algo suggestions? I tried pure MCTS with light rollouts but it seems that my top-of-my-head-buggy-virus is better, probably doing something wrong. Also, is it just me or the game’s rules are quite simple but incredibly eef’ed up to implement? :slight_smile:

Thanks, you are confirming my findings. Perhaps it is due to the fact that the system reports a win for one of the players at the end, but nothing if it is a draw.

I am also trying to get a MCTS to work, but I am stuck at ~500 rollouts in 50ms at the beginning, which is way to few I think.
Checking possible moves and the scoring (check if it would take all opponent’s seeds) is very cost intensive. And while Ultimate TicTacToe is max 81 moves, here is the limit 200…

It’s a pain to handle some seemingly endless loops in this game, especially in MCTS rollouts. Also the game length is big, mostly over 100 plies. Due to that so far I have better results with classical minimax.

Hi, is this a possible bug ?

At the end with the blue move, all seeds of yellow should be captured, no ?
But the game doesn’t capture them, and it’s now yellow’s turn (and yellow crash because he was expecting the game to be finished).

I’ve not seen a referee link, so cannot look by myself.

“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.”


Dunno how I missed it, but I did. Thanks.

Rules in this game are fairly easy. Very straightforward.
There aren’t any esoteric corner cases, like forfeits (Grand Slam it seems it’s called).

I retract :smiley:

1 Like

The source code is here: https://github.com/MaximeCheramy/cg-oware


Is there a typo in the statement?

Line 1: 1 integer between 0 and 11 (inclusive): the house played.

But you must play on one of your own houses which are in the range [0,5].

1 Like


I think there’s a bug in the referee:
Line271: while ((current < 6 && player.getIndex() == 1 || current >= 6 && player.getIndex() == 0) && (board[current] == 2 || board[current] == 3))

It should be:
while (((current < 6 && player.getIndex() == 1) || (current >= 6 && player.getIndex() == 0)) && (board[current] == 2 || board[current] == 3))

Operator precedence makes those two lines equivalent.

1 Like

Another edge case rule question:

  • Last turn before the turn limit
  • The current player makes a move that would leave all his houses empty without a possible move for the opponent to seed into them

Would the opponent still get to score the seeds in his own houses or would they not contribute to the score because of the turn limit?

The seeds don’t get counted in the score, they’d be added at the start of the next players turn. I only recently fixed this in my bot after seeing a game it thought was a win turn into a loss due to getting this wrong.

1 Like