![Build Status](http://jenkins.snake.cygni.se/buildStatus/icon?job=snake client java)
This a Snake Client written in Java 8.
- Java JDK >= 8
- Gradle
- Snake Server (local or remote)
A. Clone the repository: git clone https://github.com/cygni/snakebot-client-java.git
.
B. Open: <repo>/
C. Execute: ./gradlew build
To clean and build:
> ./gradlew clean build
To run your client:
> ./gradlew run
There is only one class in this project, have a look at SimpleSnakePlayer.java. The main method to start in looks like this:
@Override
public void onMapUpdate(MapUpdateEvent mapUpdateEvent) {
ansiPrinter.printMap(mapUpdateEvent);
// Choose action here!
registerMove(mapUpdateEvent.getGameTick(), SnakeDirection.DOWN);
}
For every MapUpdateEvent received your are expected to reply with a SnakeDirection (UP, DOWN, LEFT or RIGHT).