So, the “crunch” score addresses one of the major problems with the official code: everything is all-or-nothing. If there isn’t a spot that satisfies the buffer rules, the check is just false and every plot is equally bad, with respect to those rules. The algorithm doesn’t care if you’re 9 squares away or just 1. It doesn’t care how many other civs you’re crowded up against. So I resolved that by calculating a score instead of a boolean. The first version calculated the distance to the closest civ within the buffer, but the current version counts every tile of encroachment instead. That penalizes a plot more heavily if more than one civ is too close.
The other major difference in the Caps Lock algorithm is that it counts every violation of the placement rules, instead of prioritizing them from best to worst. That way, if two tiles are tied for civ distance, it still matters whether you are too close to a national wonder, or missing a water supply. Version 0.9.0 gave every check a weight of 1, except for the “crunch” (discussed above), and the water check (which has a weight of 2).
I quickly noticed that version 0.9.0 still had problems with polar snow starts. I dug into the “valid adjacent” check which covers both adjacent terrain and polar locations. After some analysis, I decided that it had three major sub-checks, which should each contribute to the score: distance from poles, blocking tiles (mountains & water), and barren tiles (desert & snow). For 0.9.2, I gave the polar check a distance-based score like the civ buffer, and I scored the other two subchecks 1 point each. I might tune that one further, in particular to detect mountain traps and give them a +10 score like other “impossible” starts.
Along the way, I changed my mind a few times about what to call various scores & whether to count up or down, so the code is a bit chaotic this way. I plan to clean that up before making a 1.0.0 release. I might also try to incorporate YnAMP compatibility if I can do it without creating a separate “patch” mod like is common on Steam Workshop.