Starting work on a Go implementation of Conway's Game of Life

since I had a decent amount of practice at
http://globalday.coderetreat.org/
This commit is contained in:
Dan Buch 2012-12-08 21:47:21 -05:00
parent 6bd27f93b8
commit ecffff2a60
4 changed files with 57 additions and 0 deletions

23
conway/go/Makefile Normal file
View File

@ -0,0 +1,23 @@
LIBS := \
github.com/meatballhat/box-o-sand/conway/go
TARGETS := \
$(LIBS) \
github.com/meatballhat/box-o-sand/conway/go/conways-game-of-life
all: deps build
build: test
go install -x $(TARGETS)
test:
go test -x -v -test.parallel=4 $(LIBS)
deps:
go get -x $(TARGETS)
.PHONY: all build test deps

16
conway/go/conway_test.go Normal file
View File

@ -0,0 +1,16 @@
package conway_test
import (
"testing"
)
import (
. "github.com/meatballhat/box-o-sand/conway/go"
)
func TestNewGameOfLifeIsNonEmpty(t *testing.T) {
game := NewGameOfLife()
if game.Height < 1 || game.Width < 1 {
t.Fail()
}
}

View File

@ -0,0 +1,5 @@
package main
func main() {
return
}

13
conway/go/game_of_life.go Normal file
View File

@ -0,0 +1,13 @@
package conway
type GameOfLife struct {
Height uint8
Width uint8
}
func NewGameOfLife() *GameOfLife {
return &GameOfLife{
Height: 16,
Width: 16,
}
}