Java implementation of Battlesnake Game States viewer.
battlesnake-viewer
is the command-line tool that renders Battlesnake Game State states.
- view game frame from battlesnake.com engine
- view saved moveRequest
- CLI
- file in Battle Snake JSON move request format
- battlesnake.com engine
- locale cache
ascii
- uses utf8 squares to render game state
snek
- based on Snek-Spec by Echosec. Plain text game representation that could be used for snake unit tests.
A snake always begins and ends with capital letter, with the middle segments represented by lower case letters . By default Snek-Spec assumes your snake is the snake starting with S (for snake) and ending in T (for tail).
Thus SttT
represents a snake with a length of 4 that is moving to the left.
Details https://github.com/mike-anderson/snek-spec.
run mvn package
to build jar file
After build is done, run the viewer:
java -jar target/battlesnake-viewer-1.0-SNAPSHOT-jar-with-dependencies.jar
You may add function to your shell's init script (~/.bashrc, ~/.zshrc):
battlesnake-viewer () {
java -jar ~/Downloads/battlesnake-viewer/target/battlesnake-viewer-1.0-SNAPSHOT-jar-with-dependencies.jar ${@}
}
Reload shell, and you should be able to run viewer with a simple command battlesnake-viewer
.
Usage: battlesnake-viewer [--color] [-f=<codingName>] [-t=<turn>] <uri|file>
Display Battlesnake game state.
<uri|file> Uri of the Battlesnake engine game or JSON file.
The JSON file should be in move request format. Examples:
https://play.battlesnake.com/game/d3537a9c-8f1d-41f3-9596-0f4a38e00e29
battlesnake://d3537a9c-8f1d-41f3-9596-0f4a38e00e29 # Alias to previous
path/to/local-file.json
--color Enable colors. Default true
-f, --format=<codingName>
Format for displaying the state. Possible values: ascii, snek. Default: ascii
-t, --turn=<turn> Display specific turn. Defaults to the last turn
01234567890 0 ········◼◼· 9 ···◼◼···◼◼· 8 ···◼◼···◼▪· 7 ···◼◼··◙◼·· 6 ···▪◙●····· 5 ··········· 4 ··········· 3 ····◼◙··▪·· 2 ····◼▪◼◼◼·· 1 ·····◙◼···· 0 ···········
0123456789012345678 0 #·###############·# 9 #········#········# 8 #·##·###·#·###·##·# 7 #·············●···# 6 #·##·#·#####·#·##·# 5 #····#···#···#····# 4 #··#·###·#·###·#··# 3 #··#·#·······#·#··# 2 ####·#·#◙#·#·#·#### 1 ·······#◼··#▪◼◙···· 0 ####·#·#▪#·#·#·#### 9 #··#·#·······#·#··# 8 #··#·#·#####·#◙#··# 7 #········#····◼···# 6 #·##·###·#·###◼##·# 5 #··#··········◼#··# 4 ##·#·#·#####·#◼#·## 3 #····#···#···#▪···# 2 #·######·#·######·# 1 #·················# 0 #·###############·#
01234567890 0 ----------- 9 --tt------- 8 --ST------- 7 ------vV--- 6 ------vv--- 5 -------U--- 4 ---------0- 3 0---------- 2 ----------- 1 ----------- 0 --0----0---