File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Golang CircleCI 2.0 configuration file
2+ #
3+ # Check https://circleci.com/docs/2.0/language-go/ for more details
4+ version : 2
5+ jobs :
6+ build :
7+ docker :
8+ # specify the version
9+ - image : circleci/golang:1.9
10+
11+ # Specify service dependencies here if necessary
12+ # CircleCI maintains a library of pre-built images
13+ # documented at https://circleci.com/docs/2.0/circleci-images/
14+ # - image: circleci/postgres:9.4
15+
16+ # ### TEMPLATE_NOTE: go expects specific checkout path representing url
17+ # ### expecting it in the form of
18+ # ### /go/src/github.com/circleci/go-tool
19+ # ### /go/src/bitbucket.org/circleci/go-tool
20+ working_directory : /go/src/github.com/AkselsLedins/google-hashcode-2018-live-simulation
21+ steps :
22+ - checkout
23+
24+ # specify any bash command here prefixed with `run: `
25+ - run : sudo apt-get install libgl1-mesa-dev xorg-dev
26+ - run : make deps
27+ - run : make build
28+ - run : bash test/score-a.sh
29+ - run : bash test/score-b.sh
30+ - run : bash test/score-c.sh
31+ - run : bash test/score-d.sh
32+ - run : bash test/score-e.sh
Original file line number Diff line number Diff line change @@ -9,3 +9,7 @@ insert_final_newline = true
99end_of_line = lf
1010# editorconfig-tools is unable to ignore longs strings or urls
1111max_line_length = null
12+
13+ [{Makefile,** .mk} ]
14+ # Use tabs for indentation (Makefiles require tabs)
15+ indent_style = tab
Original file line number Diff line number Diff line change 1+ # Go parameters
2+ GOCMD =go
3+ GOBUILD =$(GOCMD ) build
4+ GOCLEAN =$(GOCMD ) clean
5+ GOTEST =$(GOCMD ) test
6+ GOGET =$(GOCMD ) get
7+ BINARY_NAME =google-hashcode-2018
8+ BINARY_UNIX =$(BINARY_NAME ) _unix
9+
10+ all : build
11+ build :
12+ $(GOBUILD ) -o $(BINARY_NAME ) -v
13+ clean :
14+ $(GOCLEAN )
15+ rm -f $(BINARY_NAME )
16+ rm -f $(BINARY_UNIX )
17+ run :
18+ $(GOBUILD ) -o $(BINARY_NAME ) -v ./...
19+ ./$(BINARY_NAME )
20+ deps :
21+ $(GOGET ) github.com/faiface/glhf
22+ $(GOGET ) github.com/faiface/pixel
23+ $(GOGET ) github.com/go-gl/glfw/v3.2/glfw
24+
25+
26+ # Cross compilation
27+ build-linux :
28+ CGO_ENABLED =0 GOOS=linux GOARCH=amd64 $(GOBUILD ) -o $(BINARY_UNIX ) -v
29+ # docker-build:
30+ # docker run --rm -it -v "$(GOPATH)":/go -w /go/src/bitbucket.org/rsohlich/makepost golang:latest go build -o "$(BINARY_UNIX)" -v
Original file line number Diff line number Diff line change @@ -4,12 +4,11 @@ import (
44 "image/color"
55 "math"
66
7- "golang.org/x/image/colornames"
8-
9- config "../config"
7+ config "github.com/AkselsLedins/google-hashcode-2018-live-simulation/config"
108
119 "github.com/faiface/pixel"
1210 "github.com/faiface/pixel/imdraw"
11+ "golang.org/x/image/colornames"
1312)
1413
1514// Trip a structure which represents a trip in the simulation
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ package ghashcode
33import (
44 "math"
55
6- config "../config"
6+ config "github.com/AkselsLedins/google-hashcode-2018-live-simulation/config"
7+
78 "github.com/faiface/pixel"
89 "github.com/faiface/pixel/imdraw"
910)
Original file line number Diff line number Diff line change 66 "math"
77 "time"
88
9- config ". /config"
10- simulator ". /simulator"
11- ui ". /ui"
9+ config "github.com/AkselsLedins/google-hashcode-2018-live-simulation /config"
10+ simulator "github.com/AkselsLedins/google-hashcode-2018-live-simulation /simulator"
11+ ui "github.com/AkselsLedins/google-hashcode-2018-live-simulation /ui"
1212
1313 "github.com/faiface/pixel"
1414 "github.com/faiface/pixel/imdraw"
@@ -118,7 +118,7 @@ func noGui() {
118118 for ! simulation .Ended {
119119 simulation .Run (nil )
120120 }
121- fmt .Printf ("Score: %d in %d steps \n " , simulation .Score , simulation . Step )
121+ fmt .Printf ("%d \n " , simulation .Score )
122122}
123123
124124func main () {
Original file line number Diff line number Diff line change 88 "strconv"
99 "strings"
1010
11- ghashcode ".. /ghashcode"
11+ ghashcode "github.com/AkselsLedins/google-hashcode-2018-live-simulation /ghashcode"
1212)
1313
1414// ParseOutputFile it parse the file that your program has created
Original file line number Diff line number Diff line change 11package simulator
22
33import (
4- ghashcode ".. /ghashcode"
4+ ghashcode "github.com/AkselsLedins/google-hashcode-2018-live-simulation /ghashcode"
55
66 "github.com/faiface/pixel/imdraw"
77)
Original file line number Diff line number Diff line change 1+ result=$( go run main.go -o resources/output-files/a.out -i resources/input-files/a_example.in -noGui)
2+ echo " A) result " $result
3+ if [ $result == 10 ]; then
4+ echo " Good :)"
5+ exit 0
6+ fi
7+ echo " Bad :)"
8+ exit 1
Original file line number Diff line number Diff line change 1+ result=$( go run main.go -o resources/output-files/b.out -i resources/input-files/b_should_be_easy.in -noGui)
2+ echo " B) result " $result
3+ if [ $result == 171231 ]; then
4+ echo " Good :)"
5+ exit 0
6+ fi
7+ echo " Bad :)"
8+ exit 1
You can’t perform that action at this time.
0 commit comments