Plugging stuff into command-line runner

including adding random initial state generation.
This commit is contained in:
Dan Buch
2012-12-09 23:20:43 -05:00
parent 32095ef057
commit 00b750e2b0
3 changed files with 130 additions and 18 deletions

View File

@@ -1,5 +1,27 @@
package main
import (
"fmt"
"os"
"time"
)
import (
. "github.com/meatballhat/box-o-sand/conway/go"
)
func main() {
return
game := NewGameOfLife(40, 40)
err := game.ImportRandomState()
if err != nil {
fmt.Fprintf(os.Stderr, "WHAT IN FAIL?: %v\n", err)
os.Exit(2)
}
ticks := time.Tick(1 * time.Second)
for now := range ticks {
fmt.Printf("\n\n%v\n", now)
fmt.Println(game)
game.EvaluateGeneration()
}
}