# [Community Puzzle] Onitama

https://www.codingame.com/multiplayer/bot-programming/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?

2 Likes

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.

1 Like