package main import ( "flag" "fmt" "os" "time" ) import ( . "github.com/meatballhat/box-o-sand/conway/go" ) var ( height = flag.Int("height", 40, "Game height") width = flag.Int("width", 80, "Game width") sleepMs = flag.Int("sleep.millis", 200, "Millisecond sleep interval per generation") ) func main() { flag.Parse() game := NewGameOfLife(*height, *width) err := game.ImportRandomState() if err != nil { fmt.Fprintf(os.Stderr, "WHAT IN FAIL?: %v\n", err) os.Exit(2) } ticks := time.Tick(time.Duration(*sleepMs) * time.Millisecond) generations := 0 for now := range ticks { fmt.Printf("\nGeneration %v\n%v\n", generations, now) fmt.Println(game) game.EvaluateGeneration() generations++ } }