We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6c6b46b commit e1074a1Copy full SHA for e1074a1
Genetic/gen.swift
@@ -21,7 +21,7 @@ let DNA_SIZE = OPTIMAL.count
21
let POP_SIZE = 50
22
23
// max number of generations, script will stop when it reach 5000 if the optimal value is not found
24
-let GENERATIONS = 5000
+let MAX_GENERATIONS = 5000
25
26
// The chance in which a random nucleotide can mutate (1/n)
27
let MUTATION_CHANCE = 100
@@ -100,7 +100,7 @@ func main() {
100
// print("population: \(population), dnaSize: \(DNA_SIZE) ")
101
var fittest = [UInt8]()
102
103
- for generation in 0...GENERATIONS {
+ for generation in 0...MAX_GENERATIONS {
104
105
var weightedPopulation = [(dna:[UInt8], weight:Double)]()
106
0 commit comments