Introducing concept of mutation

which appears to delay the onset of stasis until about twice as many
generations (???)
This commit is contained in:
Dan Buch
2012-12-10 00:19:31 -05:00
parent ea5bb19b0b
commit ad1bd2537a
3 changed files with 90 additions and 0 deletions

View File

@@ -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++
}
}