Make high-degree nodes less likely to spread faction control per edge
authorTheSaminator <thesaminator@users.noreply.github.com>
Wed, 6 Jul 2022 14:40:57 +0000 (10:40 -0400)
committerTheSaminator <thesaminator@users.noreply.github.com>
Wed, 6 Jul 2022 14:40:57 +0000 (10:40 -0400)
src/jvmMain/kotlin/net/starshipfights/campaign/cluster_gen.kt

index e7fd3a34654a71096eb71fb1901ae39d1f9fddce..6d635799e2c66462b9600bf7a0cf74cdf18a32a8 100644 (file)
@@ -367,6 +367,7 @@ class ClusterGenerator(val settings: ClusterGenerationSettings) {
                                                borderingSystems += lane.systemA
                                }
                                
+                               val degree = borderingSystems.size
                                borderingSystems.retainAll(uncontrolledSystems)
                                
                                for (borderId in borderingSystems) {
@@ -374,7 +375,7 @@ class ClusterGenerator(val settings: ClusterGenerationSettings) {
                                        
                                        uncontrolledSystems -= borderId
                                        
-                                       if (Random.nextDouble() < settings.contention.controlSpreadChance)
+                                       if (Random.nextDouble() < settings.contention.controlSpreadChance / degree)
                                                systemControllers[borderId] = systemControllers.getValue(systemId).let { faction ->
                                                        if (Random.nextBoolean())
                                                                faction