Introducing concept of mutation
which appears to delay the onset of stasis until about twice as many generations (???)
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
var (
|
||||
height = flag.Int("height", 40, "Game height")
|
||||
width = flag.Int("width", 80, "Game width")
|
||||
mutate = flag.Bool("mutate", false, "Mutate every other generation")
|
||||
sleepMs = flag.Int("sleep.millis", 200,
|
||||
"Millisecond sleep interval per generation")
|
||||
)
|
||||
@@ -34,6 +35,9 @@ func main() {
|
||||
fmt.Printf("\nGeneration %v\n%v\n", generations, now)
|
||||
fmt.Println(game)
|
||||
game.EvaluateGeneration()
|
||||
if *mutate && generations%2 == 0 {
|
||||
game.Mutate()
|
||||
}
|
||||
generations++
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user