Skip to content
/ snek Public

My snake, which finished in second place at Cygni SnakeBot Challenge 2018

Notifications You must be signed in to change notification settings

oherik/snek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This aggressive little snake finished second in the Cygni SnakeBot Challenge 2018. The code is written in standard hackathonesque, that is, pretty ugly but working. The snake tries to bite any other snake that comes too close, searches for food if there's something nearby, and otherwise just tries to stall for time by finding the longest possible route.

Original readme from Cygni

![Build Status](http://jenkins.snake.cygni.se/buildStatus/icon?job=snake client java)

This a Snake Client written in Java 8.

Requirements

  • Java JDK >= 8
  • Gradle
  • Snake Server (local or remote)

Installation

A. Clone the repository: git clone https://github.com/cygni/snakebot-client-java.git.

B. Open: <repo>/

C. Execute: ./gradlew build

Usage

To clean and build:

> ./gradlew clean build

To run your client:

> ./gradlew run

Implementation

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).

About

My snake, which finished in second place at Cygni SnakeBot Challenge 2018

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages