[Community Puzzle] Onitama


Send your feedback or ask for help here!

Created by @eulerscheZahl,validated by @trictrac,@darkhorse64 and @Illedan.
If you have any issues, feel free to ping them.

I’m no regular codingamer, but time to time I get attracted. This time it was this onitama challenge which got me (it’s really amazing, kudos to the author). So I did let’s say naive minimax, got to wooden 1 and started improving (alpha beta, code optimizations, …). Eventually got to the range of 15th-20th place, which is OK for me. But another thing made me speechless. Most players show their “debug” information and most of these most show depth of their graph. I ran out of ideas how to speed it up, running Kotlin, which is not that slow either, yet first few rounds (when there are all pieces) I fail to reach depth 4, then I run on 4 until the end game with only a few pieces, then I get to 6 or more for masters-only boards. Yet the top players have depth 6 like from the beginning, which must be like million(s) of states (or not?) processed in 50ms. Going to 8 in middle game, 12 in end game. Or do they all run some monte carlos or other incomplete graph variants and yet get these great results? I think I must be missing something. Any advice/comment/correction appreciated.

How many nodes per seconds do you get? Do you use bitboard?


Well, in those 50ms, I was able to create around 10k-30k nodes. Bitboard - never heard of it, but it looks interesting, thanks!

Yeah, properly done bitboards can be faster by order of magnitude. Though I’d say kotlin syntax for bit operations sux. The other improvements would be of course better move ordering and transposition tables.

I’m just trying to check my inputs at this point

So right now my code just outputs the first valid move of the first card

I see my first output and then the game ends. The graphics do not update the characters for either my move nor the “BOSS”

Any ideas what (very basic thing) I’m missing?

That’s hard to tell without you sharing a replay of it happening.
I suspect that you didn’t format the command well (e.g. another player messaged me and it turned out he was only printing the move without the card ID).

You can have a look at the tooltip in the timeline for more info:

If you can’t figure it out on your own, feel free to share a replay or submit your bot into the arena and I can have a closer look.

1 Like

I use Python, unable to generate more than 500 nodes in less than 50ms, though I observed some algorithm complexity concerns in my graph creation as I followed some guidelines and algorithm (written here sorry in French), and needs time to debug (algorithm is working correctly though despite the optimisation part). I don’t use bitboard though.

Rust stub is broken (move is a keyword)

Rust? That would be a wontfix then.

I tried to fix it but it just keeps spinning. Too minor for me to investigate, sorry.

Also feel free to create an issue for the CodinGame SDK to add move to the list of reserved keywords.