Battlesnake 2017 entry
Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Godeps
Tests
.gitignore
Procfile
README.md
app.json
commands.go
data.go
data_test.go
filters.go
filters_test.go
gamestrings.go
graph.go
graph_test.go
headon.go
headon_test_skip.go
main.go
metadata_test.go
point.go
point_test.go
priorityQ.go
priorityQ_test.go
stack.go
stack_test.go
util.go
util_test.go

README.md

YourNewDad

This snake was my entry into the 2017 battlesnake competition. It defeated the most bounty snakes and was a contender in the semi finals of the competition.

Running

There are no dependencies just build with

go build .

Then run with

./yournewdad

The server runs by default on port 9000 although this is configurable with environment variables

PORT=8080 ./yournewdad

will run the server on port 8080 instead of 9000

Alternatively, if you just want to play against this snake it will perpetually live at http://yournewdad.herokuapp.com/

Testing

There are a lot of tests included with this snake most of them test behaviour. To run the tests run

go test

while in the directory

To add new tests when running the server add the environment variable YND_LOG

YND_LOG=true ./yournewdad

This will print out the incomming json blob on every request. You then add this to the gamestrings.go file and you can reference the blob in your test (see filters_test.go) for examples

...
data, err := NewMoveRequest(gameString17)

if err != nil {
        t.Errorf("%v", err)
}
...

NewMoveRequest is a function that parses the json blob into the internal data structure used in this program.

Improvements

The snake typically dies by running head on into other snakes or by starving if you can find a way to detect head on colisions that would be a major improvement into the usability of the snake.

The beginnings of my headon collision implemetaion can be found in headon.go and the corresponding failing tests can be found in headon_test_skip.go

It would also be really nice to have more metrics about the win loss rate of the snake overallI want to implement some sort of mechanism that tests if you have won or lost the game then stores this information so that you can view the win loss and kill ratio of the snake.