Fall Challenge 2020 - Feedbacks & Strategies

Hi all !
First of all thanks to CG and all participants. I think this challenge is one of my favorites, as it was quite original, with nice graphics. I finished #53 in legend. I learnt a lot on this challenge and on the other hand, I really failed some parts of my AI and still wonder what to do. I have some regrets on the global efficiency of the matching… I suppose it is due to the great number of participants. But well, I had to wait more than 2 hours to finish my matches. In comparison to previous challenge, I felt to have done 5 times less matches. The backfeed on modifications was thus very slow… :frowning:

My strategy was a beam search depth 15 width 200 evaluating on the score… Yes on the score because I did not manage to find better eval… Even spending hours trying ! I considered opponent only to predict a coming end (with depth 5). My learn was first basic (7 cheapest ones), but I tried to give values on different spells to see if buying a better one was efficient… Not sure I succeeded. So I won’t talk anymore of the heuristic as I really feel to have failed it.

So on what my AI was good ? clearly on data structure IMHO. For me, a node of the beam search contained 3 things:

  • the inventory (coded in [0-1000], as explained by other PM. Every inventory transformation (brew, cast, spell tax) was precomputed for this [0-1000] inventory states).
  • the achievement/readiness state on 32 bits: 5 for brew, 6 for learn, 21 for readiness (no need for more really).
  • the root move, which is only the first move of the series I propagate until end, so no need to backpath.

So the nice trick was to check if a state or better was already visited. I used BFS, so I solved depth after depth. A state is clearly better than another if it has the same inventory state and a better achievement/readiness state, that is to say at least the same bits at 1 (and possibly more). One can check it simply on A and B, bitarrays, if A&B==A, B is a better (or equal) state.

So I built a list of 1001 lists of the encountered achievement/readiness states. When I find a new element A, I go to the list of the inventory index and compare it to every element B in the list.
If I find B better than A, then I already crossed a better state, I break and trash A.
If I find A better than B, then I can break because B already passed the check before (so A would do it easily) and I replace B by A.
If I reach the end, I append A.

I first thought this check would kill my perfs. But finally it revealed to be very efficient, as A tends to improve with depth, the number of comparisons does not grow that much and the pruning is really worth. Well to be honest I found the final form of this algorithm on last sunday at 2.00 am and was not confident enough to submit it :slight_smile:

Note on the root move that I always solved in order for a depth, all REST, then CAST, then LEARN, then BREW. So by construction, BREW > a > b > c always come before in the check than a > b > c > BREW, which prevents doing a uselessly risked REST > BREW.

Now some additional thoughts, this game was nearly solo-player. The main interaction in my opinion is on the 5 first turns when both players are buying learns at the time and at the end when one stops the game. Even the concurrence on the brews is really small. Most of the games in top legend last between 32 and 40 turns. And the one who ends generally wins. Even if he took smaller potions, it has the decision to end the game in his hands and the last move is necessarily a score step for him with the last potion.
When I did matches vs top 5, I generally lost with only 3-4 potions, and I really believe that they win because they are faster. I even won some matches vs them, when my AI was luckily fast and brewed the 6th before them. I tried some match vs the dummy AI (wood boss isn’t it ?). And yes don’t worry I won all of it, but I realized that the matches last between 38-48 turns. So yeah, there is only one ressource in this game (like many other), it’s time and winners just used it better, congratulations to them !

7 Likes