Mean Max (CC01) - Feedback & Strategies

Hi, I finished 4th :slight_smile:
Here is my PM : https://github.com/Saelyos/MeanMax/blob/master/README.md

12 Likes

93rd - 2nd Javascript - Heuristics

Strategy

I have implemented an IA with only heuristics because I use javascript and it has not the performances to compete with other languages on metaheuristics algorithm. So, I did not simulate anything and my three looters act separately.

Reaper

At the beginning of each turn my IA evaluate all wrecks regarding these specifics criteria:

  • water in wreck
  • water in other wrecks with distance below 1500 of the wreck center
  • ratio between minimum distance of other reapers to the wreck and the distance of my reaper to the wreck
  • number of entities on the wreck

The main goal of this evaluation is to choose a wreck not targeted by other players. If there are no wrecks on the reaper goes to the next destroyed tanker, in order to be the first on that future wreck.

Destroyer

The destroyer first try to use a grenade on my reaper, if it is in range and there are more than two entities near it. If these conditions aren’t satisfied, it target a tanker.
Like wrecks, tankers are evaluated with these criteria:

  • ratio between water and distance to my destroyer
  • ratio between the minimum distance of other reapers to the tanker and the distance of my reaper to the tanker

Doof

Like many players, my IA use his doof to prevent other reapers to collect water. So if the doof is near a wreck and the reaper of the best enemy, it uses oil on this wreck. Else, it gets closer of the best enemy reaper.

What did not work

Before succeeding with this strategy, I have tried many other heuristics that did not work well. For example, I have tried to put a penalty on my wreck evaluation if a doof with enough rage to use oil is near the wreck or to use tar on best reaper enemy, but these tries leads to a lowest rank.

Global appreciation

Tanks a lot at the 4 creators and all the CG team for this contest. I have done my best score on this contest, for me it’s the proof that I really enjoyed it. It was very fun and appreciable to have the opportunity to reach a good rank with heuristics.
The only things that I didn’t appreciate, is the long time for submit and the debug mode who was almost unhelpful.

5 Likes

The game was really fun! But unfortunately, I also experienced timeout issues in Scala. Finished 150th with almost a third of matches being lost with a time out at first turn. Tried to respond a (WAIT, WAIT, WAIT) very quickly the first turn to avoid this but it did not help. I finally started rewriting the whole code in C++. But I did not have time to finish it in time… A little bit frustrating…

4 Likes

I think this has been the best game yet, kudos to all.

Loved that there was more than one way to attack the problem, heuristics,subsumption,searchspace,simulation where all there competing and that people who might not have the right skills to do a full sim with GA/annealling could feel they got somewhere.

The only comments i have are…

  1. could we have the full spec for later leagues? sometimes we build frameworks that become useless with new rules addid, so we can futureproof ourselves a bit.

  2. A few more comments in the ref, i often find myself helping people in chat with how things are working. I know most people wont need it but a few people do this while trying to learn :slight_smile:

  3. myself and a few in chat wished we could set some parameters for testing, working on algos with soo much going on in later leagues is a nightmare. even if we cant set up params maybe we can test in a league we already compleated?

Overall I really liked this challange, im annoyed with myself that i got sidetracked but im hoping the next one will be even better.

1 Like

This was my first contest on CodinGame!

I joined the site 3 or 4 weeks ago and didn’t really know what it was all about. I am an amateur programmer at best, and the things I learned in this contest are astounding.

I had never heard of a genetic algorithm before. I had to google “heuristics.” I really had no clue about anything.

Well, now I know a whole lot more. I did not use a GA, of course, I wouldn’t know where to start, but I did manage to make it to Gold league with the help of some people in the chat, and mostly just by observing the chat and stealing others’ ideas that they offered up :slight_smile:

The most amazing thing to me was how simple it was to get to Silver league after learning about the destination = destination - velocity * 1.5 formula.

I think the lower league example of analyzing the angle to target and changing thrust made me think that was how to go about things, and my code was a mess of conditions and Bronze was the best I could do. After scrapping all of that and just using that formula, I shot up the board into Silver immediately.

Getting into Gold was another struggle, but again I was saved by a helpful tip (thanks MadKnight). This time it was a very simple wreck-scoring algorithm, (water content) * FACTOR - (distance to reaper). I forget what the factor was, but it was high like 12000 or something. This got me into Gold with practically no SKILL use at all.

I finished around 245th in Gold I think, which is beyond what I expected in the beginning of the contest, so I was happy. I am now much better equipped to handle future contests and really just enjoyed the experience immensely.

Thanks to the creators and congratulations to the winners!

5 Likes

Thank you for sharing your overall strategy :slight_smile:
Could you please give some details regarding the createMoveActionStopOnTarget method?
I’m not sure to get what you are doing. Where these variables come from: “next”, “newVx”, “newVy”, “vx”, “vy”?
Thank you

Peut-etre une question stupide, mais comment retrouver son code du challenge avant la fermeture ? Je me retrouve avec le squelette de base au niveau du code, et je ne suis pas sur d’avoir sauvegardé (par moi-meme) la derniere version de mon code :frowning:

Stupid question : how do you retrieve the source code you used during the challenge, before it was closed ? I am not sure my own last save is really the last code used :frowning:

I have edited my post as there was an error.

See the following picture to understand the compute

3 Likes

Each contest has a report visible on https://www.codingame.com/contests/finished which includes your final source code.

2 Likes

Thanks a lot !!

Thank you, this is clear now :wink:

First, a big thank to the creators for this amazing contest!
One thing that seems to have helped me is to create a “wind rose” for my reaper. For example, each ~10 degrees angles and always the same distance (let’s say 1000), investigate the next point where my reaper would land. For this I used the equations for the next speed given in the referee (in the thrust function). I would then select the best orientation according to the closest distance to the point I want to go. This is kind of a ‘one turn’ simulation, and only for the reaper, without taking into account collisions, but it seemed to have helped quite a lot.
Thanks again, looking forward to the next CC

3 Likes

PHP - 415th / 2512 - Heuristic

This was my first Contest, and my first post on this forum :slight_smile:

My IA firstly search a strategy for the reaper, secondly for the doof, and finaly for the destroyer.

Reaper :

If there is wreck on the map :
I put a score on each Wreck : bonus if closest of my reaper, bonus if contains more water, and malus if covered by oil.
My reaper go to the highest scored werck.
This is my “wreck strategy”.

If there is tanker on the map :
My reaper go to the Tanker closest of one of the three Destroyer.
This is my “tranker strategy”.

If there is nor wreck or tanker the reaper return to the center of the map.

Doof :

Secondly, the doof. I search where the doof should put the oil. I test this cases in this order, if one is true, i put the oil on :

  • on the wreck that is under the reaper of the best enemy (best score)
  • on the wreck that is under the reaper of the other enemy
  • on the wreck where my reaper go, if one of the other reaper is closest of the same wreck
  • on the wreck with distance of enemy reaper more than the distance of my reaper from the wreck + 3000
    For each of this tests, I verify is the wreck is not already covered by Oil.
    I also verify the distance, and if the test failed only by the distance I store the wreck in a variable, in other to target the wreck with a grenade of the destroyer.

if there is no Wreck on the map, or if I have not enough Rage, then my Doof follows the best Enemy Reaper.

Destroyer

My destroyer throws a grenade on the wreck that the doof wants to target but can’t because of the distance (distance doof <-> wreck > 2000).

Else, if my Reaper strategy is to follow a tanker, then my destroyer follow the same tanker.

Else, my destroyer follow the best enemy reaper.

Here are my strategies to reach Silver League.

With some improvements this AI can reach Gold League.

https://github.com/charlesfranciscodev/mean-max-ai/blob/master/README.md

What is “remainingTime”?

How long the current round is still going. Initially it is 1, but when you detected one collision at t=0.3 for example, it will be 0.7 for the next collision check.

But the formula looks wrong to me, shouldn’t it be:
double posx1Min = position.x-radius + Math.min(0, remainingTime*speed.vx);
Why multiplying the position with the remaining time?

2 Likes

Wow ! What a mistake I did and no unit test to cover it up :confused:
Thanks for spotting it eulerscheZahl.

I just resubmited my code with the correction but it doesn’t seem to change my final position …

First of all congrats @iadevoops.
What do you mean for “an angle parameter for the reaper”?

1 Like

thanks @giganoide
“an angle parameter for the reaper” : I compute the angle between the reaper and the choseen target then i add {0°, +30°, -30°} to this angle for the first and the second move in the simulation.
If there is no obstacle between the reaper and the target, the best score will be for 0°, but if there is an obstacle like tanker or another looter, the simulation will choose +30°, -30° because the reaper will reach near to the target faster by contourning the obstacle.

1 Like

2 posts were merged into an existing topic: Mean Max: Suggestions