Storing moves between turns


Hello, I am relatively new to this competition and am not a professional. Is there any way to store the previous moves for each ship? I am having a problem with my ships getting stuck and would like to implement something that, evaluates if they have been still for x amount of rounds and then forces a move if this is true. I realise the source of the problem is poor navigation, but that is beyond my abilities at the moment.

Add attribute to entity (Python)

One of the easiest ways is to put a dictionary (hash map) inside a Game or Map or Navi object (depends on your programing language, some starter kits doesn’t have Navi) and store ShipId -> any info you need.

Just don’t put this info inside a Ship object, since these objects are recreated each turn (this is a design decision of starter kit authors).


I am using python. Can you store more than one move per ship with using a dictionary?


You can probably put an array inside of dictionary, why not?


Is it possible not to recreate these objects each turn in Python? What is the purpose of recreating them?


I suppose it was easier to implement. If you want persistent entities, you have to implement it yourself (not a big deal, though).


There is an issue started on the repo regarding persistent ship objects here, with a preliminary implementation here.


Does this work already, if we replace the method in the file, or will it only work if the other things out of our control are updated? Im guessing the __ships also needs to be added somewhere


I’ve been using the modded _generate method.
Yes, __ships needs to be added.

See the actual code changes or download that file version.