blah_blah_blog 2.0

Adam Adair's lousy blog and other assorted blather

CodinGame Spring Challenge 2020 - Day 5

Today is day 5 of the CodinGame Spring Challenge 2020 and today I need to defeat the Bronze boss. Yesterday was Mother’s Day and I didn’t get much done and right now I am 1362/2515 in the league, or in other words my bot is a steaming pile at the moment. If I can’t get this bot out of the Bronze League today I will have to seriously consider dropping out of the competition.

It’s not as bad as I am making it out to be, because my bot can defeat the boss as is. Inky the ghost is the Bronze League Boss and here is a replay of my bad bot beating him.

The List of Problems

  1. The bot does not account for other bots in its path. This problem is two fold:
    • Once my pacs start butting heads with each other they are out of the contest. They continue to butt heads until they are killed by an opponent or the game ends.
    • My bot does not detect enemies on path, and this is resulting in my pacs being devoured regularly. We need to Roshambo or run away.
  2. The target cell assignment is not efficient. It’s first come first serve at the moment, so the pac with id=0 gets his first pick, regardless of whether any other pacs may be closer to that valuable spot. #1 goes second, etc…

The Plan

  1. Go forth on your path as fast as you can.
  2. If something gets in your way then turn

Path prioritization

  1. Value of target cell
  2. Distance to target cell

The Rules of Roshambo

  1. If an enemy is on path and I can defeat it and it can not change, continue to move.
  2. If and enemy is on path and I can not defeat it and I can not change, I must run away.
  3. If an enemy is on path and I can not defeat it but I can change and it can not, do the change to a winning type.
  4. Otherwise, find another path

The Results

I implemented the following changes:

  • A* Path finding
  • The Rules of Roshambo

I moved up to #335 in the Bronze league. I can defeat the Bronze Boss 10 out 10 times, but not the players between me and the Bronze Boss. There are still some low hanging fruit that may get us a little further up the ladder, but I’m worried that I may have left this until too late.