https://github.com/figbug/jucebattlesnake
Battlesnake written in C++ / JUCE
https://github.com/figbug/jucebattlesnake
Last synced: about 2 months ago
JSON representation
Battlesnake written in C++ / JUCE
- Host: GitHub
- URL: https://github.com/figbug/jucebattlesnake
- Owner: FigBug
- License: gpl-3.0
- Created: 2020-03-22T16:30:08.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-25T13:12:27.000Z (about 5 years ago)
- Last Synced: 2025-02-07T22:34:56.171Z (3 months ago)
- Language: C++
- Homepage:
- Size: 11.4 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JuceBattleSnake
A framework for writing snakes in C++ with JUCE for https://play.battlesnake.com/
Easy to use:
Inherit from the class `Snake` and implement the function `virtual Direction getMove() = 0;`
The `getMove` function should update the `currentDirection` member variable and then return it.
To build a snake:
Set the port for your webserver:
```
bs::Webserver::Options o;
o.ports = {7777};
```
Make a snake pit:
```
snakePit = std::make_unique();
```Add some snake eggs to the snake pit. Every time a new match starts your snake egg should create a new instance of your snake. My snake is named Miranda.
```
snakePit->addSnakeEggs ([] () { return new Miranda(); });
```Then start the webserver:
```
snakePit->start (o);
```