Strategy for AI contest https://aicups.ru/. Rules of the contest is described here (but olny in Russian): https://github.com/MailRuChamps/miniaicups/tree/master/paperio. In general - rules are almost the same as original classic http://paper-io.com/ game with some modifications. Six strateges from different participants fight simultaneously in square arena, each bot has full information about arena state. Points are granted for territory capture (neutral or rival's), rival killing or using saw.
The highest place I took is 34 out of ~300, but at the end I didn't succeed to pass to the next round. My solution is not ideal, code is full of dirty hacks, magic numbers, code duplications etc. I needed to write as fast as possible, try new ideas quickly, and didn't have much time for refactoring. This repo was private during contest and I didn't edit anything before publication intentionally, showed as it was.
My solution is based on potential fields idea. Bot builds square field up to 8 cells around, each cell in the field has numerical value as sum of potentials from different sources. Neutral territory and rival's territory, bonuses, rival's tails have positive potential, it attracts my bot. Enemy itself and cells deep inside my territory have negative potential, it pushes the bot away. After field calculation strategy builds path to cell with the highest potential, path is also calculated to visit as much "good" other cells as possible. This process can be interrupted by safety checks: before sending new command I check if I can be killed by other bots (I assume they all always want my death). If so, I return to my territory by the fastest way. All restrictions are considered.