Skip to content

m-schier/battlesnake-starter-c-sharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C# starter snake for BattleSnake

This starter snake is currently unofficial

This is a basic BattleSnake AI written in C#.

Visit https://docs.battlesnake.io for API documentation and instructions for running your AI.

Requirements

Install .NET Core SDK to build this project.

Brief overview

The StarterSnake.Startup class starts a new server using the StarterSnake.StarterController class to control snake movement. This movement is random and will lead to rather soon death. You may either implement your own controller inheriting StarterSnake.Service.ISnakeServiceController or improve the existing controller directly.

Generally there should be no need to modify code inside the StarterSnake.Service and StarterSnake.ApiModel namespaces.

Running the snake

By default the snake runs a server on port 5050. You may change this through the environment variable PORT.

dotnet run -c Release

Deploying to Heroku

  1. Create a new Heroku app:
heroku create [APP_NAME]
  1. Set the correct heroku build pack for .NET Core
heroku buildpacks:set jincod/dotnetcore
  1. Deploy code to Heroku servers:
git push heroku master

You may have to register your app name as a git remote if git does not recognize 'heroku'

heroku git:remote -a [APP_NAME]
  1. Open Heroku app in browser:
heroku open

or visit http://APP_NAME.herokuapp.com.

  1. View server logs with the heroku logs command:
heroku logs --tail

Releases

No releases published

Packages

No packages published

Languages