I am trying to figure out how to avoid crashing my ships into enemy ones but for now the best solution I have is checking if the position I am about to choose contains enemy ship in it but of course it does not take into the account that shpip will move. Could anyone please give me any hints how to improve this?
Simplest idea I have is to mark and enemy ship and the four squares surrounding that ship. As long as you stay out of that range / never boarder it you’ll never have a collision.
Marking where enemy ships currently are and avoiding those locations is fairly standard for avoiding collisions. Anything more than that involved you making an educated guess about which direction they’ll be moving next. 3 things I would suggest considering are the following:
- How much halite is available at their current location? If there’s still a sizable amount available, it’s unlikely they’ll move on before mining some more.
- how much halite are they holding in their cargo currently? If they’re max or close to it, they’re likely heading for the closest drop off point.
- Which of their surrounding positions has the most halite available? If the bot is using a greedy algorithm, there’s a chance that the next move will simply be to the position with the most halite nearby.
This is all guess work of course because we don’t know how every single bot is going to respond to every situation. I would assume however that incorporating the above methods will increase your odds of correctly predicting the movements of enemy ships.
On a side note, being able to predict their movements and where to avoid should also improve your ability to track and destroy enemy ships with full cargo holds.