Fantastic Bits - Feedback & Strategy

The challenge is now over and, as the best of you keep making matches to reach their final ranking, you can now tell us how how you liked the challenge, & how you solved it. (Do not post full code here.)

Don’t forget to register to the next contest here:


Contest was awesome, the game idea was easy enough to understand, but deep enough to offer a good challenge. Times were much better than HyperSonic, which is good.
All in all, bravo to all the CG team, coming up with good programming game ideas is not easy at all, and you keep nailing it. We want more!!

About the logic I used:
I ranked somewhere in mid-top gold. I still don’t know the exact number.
Getting out of wood was as simple as finding the nearest snuffle and throwing it towards the goal. I started using accio on everything that was behind me, but only if an opponent player is closer to the snaffle than I am. Got to silver, then started putting more enphasis on flipendo and skyrocketed to gold. In gold I added petrificus, and started refining the conditions for spell usage, like lining up flipendos and having distance thresholds.
Last little bit of improvement was passing to the other player if he is ahead and close enough, and moving towards the predicted snaffle position (using velocity) as opposed to the actual snaffle position.

I’m sad I didn’t get to Legend. Probably could have dedicated some of my time to better improvements. All in all, I’m extremely happy about the whole event :smiley:


Good points

  • Very fun
  • A 1v1 game with 100ms for the response time. So submits are pretty fasts
  • I won the contest \o/

Bad points

  • Noob killer. Many things we can’t know without a big amount of work. We don’t have our own mana in the inputs …
  • Random t shirts are bad. I don’t want to be the 11th :smiley:
  • Many bugs at the start in the referee program. And like always we have to wait monday :frowning:

Thank you CG for organizing this fantastic contest! This is my first serious contest, after seeing that I had a chance to enter the legend league =)


  • The rules are interesting and balanced enough for fun games
  • The animation is great!

Not so good

  • No further rule addition after Bronze?
  • Information shown in the animation during replay and what’s known by the bot is quite different.

Solution Ideas

  • Flipendo after throw -> this got me until silver, and with a bit more heuristics, got me until gold
  • Aiming properly for throwing and movement using vector arithmetics gave me another significant boost
  • The rest are engineering the rules and numbers based on replays =/
1 Like
  • very fun
  • as said Magus, too much things for one week. I think simulate positions, speed and collisions is ok (but already a huge work), guess mana, goals, spells from other player is too much.
  • graphics are wonderful


1 Like

As usual from my side, 8 days not enough.

I’m really demotivated and now prefer do not spend so much time on contest as before.

There was discussion on simulation topic, and there was argument - “consider contest as exam”.

Completely disagree. Consider contest as possibility to show everything that you can, 100%. When contest finished, just answer yourself - “Can you do it better at this time and your knowledge?”. If answer - “yes” - than contest is done for you, read papers, try learn another algos and so on. But for me usually answer - “no”. Due to lack of time I just finished simulation and have time only to some basics strategies. And usually during contest we need to learn how to write good code. Lack of time introduce a lot of bugs, and make code ugly.

This was with CSB, Fantastic, Ghosts… Probably only with Hypersonic and Accountant I said to myself - yes, I don’t know how to do this better at this time, I need to learn.


BlitzProg, ~650

Immediately at the start, I knew this would be painful to simulate. I dislike a lot challenges where too much mathematics are involved and I do not have that much time to invest, had many other hobbies requesting my attention, and was only free for a single day, the last day of the tournament.

I tried to get collisions right using my Coders Strick Back engine, which is currently in the legend league.
Unfortunately, I couldn’t get it right and a glitch about collisions prevented me from starting any reliable simulation at all, so I gave up and tried to work on the test submit that eventually made it to Gold league with just a few hours of code.

That didn’t do good, at all. For some reasons, any behavior I thought to be smarter and got to work accurately (flipendo precise calculation with simple rebound for snaffle, petrificus on dangerous snaffles, etc) did much worse and ranked all the way to the bottom of the league (bottom 1%!) while the naive algorithm I beat the Gold boss could do better than 25% of the players.

My naïve strategy:

  • Target the closest snaffle that wasn’t targeted by the other wizard,
  • If you have the snaffle, throw it in the direction of the goals.
  • If you don’t, if it is in front of the goal (if the straight line [wizard - snaffle]) and you have at least 20 mana, use Flipendo.
  • If it is far behind you and you have 40 mana, use Accio

This naïve strategy only requires some line intersection formula to find out if you can Flipendo and goal, but you can find that formula easily on wikipedia and simplify it to your needs.

1 Like

Tried many things (beam search, genetic algorithm, simulated annealing…) but couldn’t get past the silver league :slight_smile:

I ended up submitting a “simple reflex agent” which I thought was better than my others AIs but it wasn’t at all :relaxed:

This final submission got me to the 1399th place :cry:

1 Like

Thx a lot :slight_smile: was realy fun…

Speaking of fun, i always prefer do an algorithm than using system simulating futur turns, and let it find the better strat by setting variables…

So, my strat:

  • selecting 2 target for the 2 wiz depending on situation (REALY important)
  • Checking if i can do a SAFE flipendo…
  • i check other spell, but ALWAYS keep 20 for a flipendo in case an opportunity append… (better to make a point than trying to save 1)

That’s all ^^

I’m legend, Debbugged so mush today that i was unabble to let a submit finish, but hope to finish in the Top 50 ^^ (Actualy 46 ;p)

THx again :slight_smile: Can’t Wait for Ghost In The Cell :slight_smile:



Thanks a lot for this contest, it was really fun. :slight_smile:

I don’t know yet how to simulate, so I have basically made an algorithm.

Here is how he work :

  • Test if I can make a flipendo who goal
  • If not test if I must make an accio
  • If not go to the closest Snaffle

:smile: I finish 599, in the gold league (I’m proud of that :blush:)

I’m impatient to see the next contest (Ghost In The Cell) :smiley:


That was really a fun contest. I enjoyed the game possibilities a lot even if I didn’t explore that much of them.

For me simulation was not reachable, as I directly struggled with the basic maths ( I finally made a line calculation to throw my flipendo, but that didn’t improve my rankings too much).

I proceeded like the Codingame did in their stream, surely with slightly different code but the logic was pretty much it:

  • Can score with a flipendo?
  • Is there a snaffle in my back, then use accio
  • Get closest snaffle and throw it towards the goal

Can’t wait for the next challenge!

1 Like

Very fun game with nice visual representation.
Very complex as well, it looked probable that simulation strategies would win it, since there are just too many situations / use cases to cope with to write a descriptive AI.

I had never done simulation on a “physic game”, so it was the occasion to start, but with average skills and not so much time, I was only able to simulate moves and collisions by the end of the contest and wrote no AI code at all (and even this was only possible thanks to Magus’s CSB cookbook) !
So my commit is the one of the first saturday evening :slight_smile:

Can you please confirm that the game is going to be available in multi ?
I’d really like with more time to be able to actually work on the AI part and make use of the simulation engine !

1 Like

The game was interesting but kind of too complicated for a programming game. At the very least if it’s going to have this many rules we should have had more time and/or the referee program.

The irony is you probably thought this would give heuristics a bigger chance of competing against simulations. But this game gives you such a tremendous advantage when you simulate. To give one example you can trivially dodge bludgers and use them to your advantage with a few turns of simulations, the sort of thing a heuristic will never do.

Finished 12th with this:
Implement the game engine with as few bugs as possible (still very bugged)
Assume enemies move according to bronze boss AI: Move to nearest snaffle, throw towards goal
Search 4 turns ahead with a Simulated Annealing algorithm
Evaluate strategies as Eval(turn 0)+Eval(turn 1)*0.7+…
Simple evaluation function:

  • Distance of snaffles to my goal-Distance of snaffles to enemy goal
  • Distance of my wizards to their nearest snaffle
  • Snaffles held by my wizards - Snaffles held by the enemy wizards
  • Speed of snaffles to enemy goal-Speed of snaffles to my goal
  • My Score - Enemy Score
  • Huge points for winning/losing the game (last goal)
  • Having mana

Would have probably ranked better if I’d been able to debug my simulations.
I kind of like the game it’s pretty cool, but as a one week contest, looking back all I can see is 99% debugging, 1% trolling on the chat and 0% strategy. Maybe if I hadn’t been as busy I would have had the time to finish my engine and enjoy the actual game.


Hi, this contest was very fun and very nice. A lot of strategies were possible because many features were available. One regret on the turn count limit. 200 is not very much when battle is balanced, and sometimes, some interesting placements could be done to win with more fun, and we don’t have the time for that.
But as always, this game was a big experience which was very challenging.
Thanks a lot to Codingame for this great moment.

I didn’t have a lot of time for this one so I decided to go with a straightforward strategy :slight_smile:

  • If you have a snaffle, throw towards the opponent goal
  • Else get to the closest snaffle
  • If you have a direct line to the goal (or a line with 1 bounce on the top/bottom) and you are far enough from it that it’s worth it, flipendo

This got me to gold, afterwards I had to implement or rather debug a collision system to reach legend where I finished 79th.

I didn’t use Petrificus at all or Accio/Flipendo on other units due to lack of time, lack of mana and more efficient use of Petrificus (almost guarantee to score if you use it correctly). I’ve seen some of the top IA make good use of Petrificus but 90% of the time it’s probably wasted mana and a Flipendo might be a better defense.

The maps with 5 snaffle are really more about tactics than strategy and I think a big incentive to hardcode some of it, which is a bit sad I think, overall I the game may have been too fast paced to my liking.


I really loved the contest. Thanks Coding Game for bringing it to live.

I ended 48th GOLD (194th total).
This was such a good challenge, But I could not get my simulation to work properly.
I reverted to a more direct approach Closest Snaffle, Throw then Flipendo, Flipendo when alligned or with rebound to the goal.

A lots of things I could have done since it was a little mix of CSB, Ghost buster, and Accountant, in my view. In none of thode did I try to implement a simulation so this one was a trial. I failed. But I learned a lot.

In the end, the important in those contests is to improve ourself. This one, for most of my friends, was a little scary to many things could happen. That is true, however keeping a simple approach could get you a long way.

The top guys are genius, they deserve their prizes.

As for the tShirts: Of course i’d like to get a random one. but I agree that the 11-50 should get theirs. that would account for 40, make a draw with the 10 left for the 200 remaining of the 250 firsts. That would be only fair.

Thanks again Coding Games.

PS:I improved almost every contest since I started (with Smash the Code) I hope i’ll make it to legend in a challenge soon


It was my 4th time to participate in a tournament, and it’s been my worst result. However I’m feeling very satisfied about myself because I’ve learnt a lot. I was always wondering how one can do simulation when there is ((almost) infinite choices * several players) to consider at each turn, and this time I was really willing to tackle this problem. Finally I could make a working simulator and could forecast between 5 and 10 turns ahead in 100ms. The problem was, I spent all my time on solving this problem, and I had no more to search how to use it efficiently ! Anyway it’s been a success in term of self improvement.
So my strategy was :

  • make a local simulation of the game engine
  • define a set of few actions possible for my wizards (go to nearest, go to snd nearest, go to my goal, go to opp goal, cast flipendo/accio, throw to goal directly/with a bounce)
  • define a simple heuristic for opponent wizards (go to nearest, throw to goal, cast flipendo if aligned)
  • at each turn, simulate as deep as possible for each combination of action for my wizards plus heuristic for opp wizards and calculate the value (based on score and relative positions of wizards/snaffles) for the resulting board, (heavily) prune what’s impossible/not interesting, sort the tree at depth level but not globally and move breadth first, then choose the action which lead to the highest score leaf of the tree.
    This brought me to middle of Gold. I think I needed to work more on pruning and the set of actions.
    Good points for this tournament :
  • It was really really fun
  • Self improvment
  • Lot of reusable code for next tournaments
  • Servers were running so fast I could kept working up to the end
    Bad points :
  • Bugs in the game and errors in the rule statement
  • You’re so slow to answer messages on the forum…
  • As usual, ranking varying of hundreds between two submits of the same code. I don’t even use it any more to evaluate my code, I prefer to judge only from looking at the replays. I understand it’s a very difficult problem but is there really anything you can do about it ? For example, have you consider creating several sub-bosses equally distributed accross each league ? If the problem comes from applying the ranking algorithm to compare algos that are themselves not properly ranked (because they are still under modification at a quite high pace), applying it to stable, never modified, algos would help, isn’t it ? You already have bosses so it should be quite easy to tweak parameters to create weaker/stronger versions at will… Don’t know if it’s good idea, if it would work, if it’s so easy to do, … but please consider it.
    Anyway, thank you ! I’ll be there for Ghost in the Cell !
1 Like

-the contest was fun
-easy to enter, basic if else was enough to get in gold
-the ones who wanted to get in top, had to reverseengineer the physics engine. it took me 3-4 days, i’d spent these days to write te AI itself. it’d make sense to release the code of the engine
-one week is too few to the ones, who can’t play CG 0-24 ( was not my case :stuck_out_tongue: ), for complex contests like this one
-oh and almost forgot the random t-shirt :frowning:


I agree! 8 days are already short. In the other hand, Fantastic Beast is so much harder than Coder Strike Back. The contest would have much better bot if it lasted longer.

1 Like