static int ai_mapPenaltyWithIncompatibleWordsList(SS map, Set incompatible, int extraPenalty) { int p = 0; for (S a, b : map) { ++p; if (containsOneOf(incompatible, a + "/" + b, b + "/" + a)) p += extraPenalty; } ret p; }