From 0ac0b4cab9c87b6f390a258ce90cb8cea9cc20e2 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 11 Dec 2012 18:43:15 -0500 Subject: [PATCH] Cleaning better and using chars with more contrast. --- conway/Makefile | 8 +++----- conway/game_of_life.go | 9 +++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/conway/Makefile b/conway/Makefile index c9c43dd..0cda8b6 100644 --- a/conway/Makefile +++ b/conway/Makefile @@ -4,20 +4,18 @@ TARGETS := \ $(LIBS) \ github.com/meatballhat/box-o-sand/conway/conways-game-of-life - all: deps build - build: test go install -x $(TARGETS) +clean: + go clean -x -i $(TARGETS) test: go test -x -v -test.parallel=4 $(LIBS) - deps: go get -x $(TARGETS) - -.PHONY: all build test deps +.PHONY: all build clean deps test diff --git a/conway/game_of_life.go b/conway/game_of_life.go index 9df60e9..e477141 100644 --- a/conway/game_of_life.go +++ b/conway/game_of_life.go @@ -10,6 +10,11 @@ import ( "time" ) +const ( + DEAD_CELL = "■" + LIVE_CELL = " " +) + func init() { rand.Seed(time.Now().UTC().UnixNano()) } @@ -284,7 +289,7 @@ func (state *GameState) String() string { for y := 0; y < height; y++ { var cells []string for x := 0; x < width; x++ { - stringVal := "■" + stringVal := DEAD_CELL value, err := state.Get(x, y) if err != nil { @@ -292,7 +297,7 @@ func (state *GameState) String() string { } if value == 1 { - stringVal = "□" + stringVal = LIVE_CELL } cells = append(cells, stringVal) }