The latest Codingame competition was a Puyo like game where bots were playing against each other in parallel. The goal of the game was to survive longer then the opponent. Players were dropping colored balls in a tetris-like fashion and when at least four balls of the same color got connected they were then cleared and the score of the player has been increased. This has been connected to an action of dropping skulls on the opponent’s board, essentially blocking him from playing out as planned.
The game seemed to be quite easy at first, and as the boards are separated there wasn’t much interaction between the bots first, but as the competition progressed the dropping of skulls (especially when doing so to avoid getting skulls on our own board) became a crucial point to be able to win.
There was a nice addition on the site compared to the previous challenges, and it was the league system. Each player started in Bronze league where they needed to beat an AI bot created by the organizers. Once being able to rank above the Boss, players have been promoted to Silver, Gold and Legend leagues, where they all faced Bosses to beat. Only a small portion of players reached Legend in the end, around 10%.
My approach to this challenge was quite simple. I ran random playouts for my opponent and for myself to figure out what would be the best strategies on my end, while keeping an eye on the opponent’s options at the same time. The latter was important because I was able to prepare for skull drops effectively. I figured there is a pattern which can determine the enemy skull drop by an accuracy of 90%. Looking at the opponent maximum skull drops on each turn will essentially start to converge to a peak after he starts to commit to it. So the very basic strategy was to run simulations without getting those skulls dropped, then run simulations taking the skulls into account, and see if letting the opponent drop the skulls would hurt at all. Then I’ve also added simulations to try and prevent the opponent’s skull drop by dropping skulls on him instead, and summarizing the results of these three simulations gave the bot a great understanding on whether he should ignore or prevent the opponent skulls.
I was ranked in the 20s all along the tournament, but as I was unable to dedicate any time in the last two days I finally dropped out of the top places. In the end it was very important to be able to effectively find the best opening moves which sets up the biggest combos in the first couple of turns, and given the search space (22 options with a look ahead of 8 turns) without a really good heuristic most bots failed to find the outstanding moves at the beginning, which then lead them to be destroyed quite early.
Legend league: 70/246
Overall I’m happy with the results considering that I haven’t changed the basic approach since the first day of the competition. I’ve done a lot of work on optimizing my simulation, which was able to run ~8.000 games at the beginning, and ~60.000 at the end. I hope the next challenge will be with a bit more interaction with the other players. I liked this parallel play idea, but I missed the importance of turn by turn interactions.