Package ai.nettogrof.battlesnake.snakes
Class Snake.Handler
- java.lang.Object
 - 
- ai.nettogrof.battlesnake.snakes.Snake.Handler
 
 
- 
- 
Constructor Summary
Constructors Constructor Description Handler() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>end(com.fasterxml.jackson.databind.JsonNode endRequest)/end is called by the engine when a game is complete.Map<String,String>move(com.fasterxml.jackson.databind.JsonNode moveRequest)/move is called by the engine for each turn the snake has.Map<String,String>ping()/ping is called by the play application during the tournament or on play.battlesnake.io to make sure your snake is still alive.Map<String,String>process(spark.Request req, spark.Response res)Generic processor that prints out the request and response from the methods.Map<String,String>root()/ is called by the play application during the tournament or on play.battlesnake.io to make sure your snake is still alive.Map<String,String>start(com.fasterxml.jackson.databind.JsonNode startRequest)/start is called by the engine when a game is first run. 
 - 
 
- 
- 
Method Detail
- 
process
public Map<String,String> process(spark.Request req, spark.Response res)
Generic processor that prints out the request and response from the methods.- Parameters:
 req- Request receivedres- Response object- Returns:
 - map of field,value
 
 
- 
ping
public Map<String,String> ping()
/ping is called by the play application during the tournament or on play.battlesnake.io to make sure your snake is still alive. API v0- Returns:
 - an empty response.
 
 
- 
root
public Map<String,String> root()
/ is called by the play application during the tournament or on play.battlesnake.io to make sure your snake is still alive.- Returns:
 - apiversion:string - Battlesnake API Version implemented by this Battlesnake author:string - Optional username of the Battlesnake�s author head:string - Optional custom head for this Battlesnake tail:string - Optional custom tail for this Battlesnake color:string - Optional custom color for this Battlesnake .
 
 
- 
start
public Map<String,String> start(com.fasterxml.jackson.databind.JsonNode startRequest)
/start is called by the engine when a game is first run.- Parameters:
 startRequest- a map containing the JSON sent to this snake.- Returns:
 - a response back to the engine containing the snake setup values.
 
 
- 
move
public Map<String,String> move(com.fasterxml.jackson.databind.JsonNode moveRequest)
/move is called by the engine for each turn the snake has.- Parameters:
 moveRequest- a map containing the JSON sent to this snake. See the spec for details of what this contains.- Returns:
 - a response back to the engine containing snake movement values.
 
 
- 
end
public Map<String,String> end(com.fasterxml.jackson.databind.JsonNode endRequest)
/end is called by the engine when a game is complete.- Parameters:
 endRequest- a map containing the JSON sent to this snake. See the spec for details of what this contains.- Returns:
 - responses back to the engine are ignored.
 
 
 - 
 
 -