Just occurred to my Economist-ridden mind that there is a good way to discourage the AI from having untidy boarders, and it's quite a simple method (to mathematicians) - imposing a constraint on non-convex borders.
Take the mid point of each boarder territory and draw a line between it and all other border territories (I believe most computer languages are ok with Euclidean vectors and Cartesian spaces). If that line passes through an enemy/nonfriendly nation, penalise.
The check only needs to be done once a year and would flag countries for conquering.
Of course, you could have already implemented smarter borders, in which case carry on brave frontiersmen!
Take the mid point of each boarder territory and draw a line between it and all other border territories (I believe most computer languages are ok with Euclidean vectors and Cartesian spaces). If that line passes through an enemy/nonfriendly nation, penalise.
The check only needs to be done once a year and would flag countries for conquering.
Of course, you could have already implemented smarter borders, in which case carry on brave frontiersmen!