Too much crap for one commit
Breaking out console runner into its own file, adding an empty web runner, and starting to test that games and game states are able to represent themselves as images.
This commit is contained in:
@@ -14,6 +14,7 @@ var (
|
||||
height = flag.Int("height", 40, "Game height")
|
||||
width = flag.Int("width", 80, "Game width")
|
||||
mutate = flag.Bool("mutate", false, "Mutate every other generation")
|
||||
web = flag.Bool("web", false, "Run server for web-based game")
|
||||
sleepMs = flag.Int("sleep.ms", 200,
|
||||
"Millisecond sleep interval per generation")
|
||||
)
|
||||
@@ -21,9 +22,21 @@ var (
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
retCode, err := RunConsoleGame(*height, *width, *sleepMs, *mutate)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %v\n", err)
|
||||
var (
|
||||
retCode int
|
||||
err error
|
||||
)
|
||||
|
||||
if *web {
|
||||
retCode, err = RunWebGame(*height, *width, *sleepMs, *mutate)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %v\n", err)
|
||||
}
|
||||
} else {
|
||||
retCode, err = RunConsoleGame(*height, *width, *sleepMs, *mutate)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
os.Exit(retCode)
|
||||
|
Reference in New Issue
Block a user