#battlesnake #types #game

battlesnake-game-types

game types for play.battlesnake.com

18 releases (breaking)

0.17.0 Jan 22, 2023
0.16.0 Nov 20, 2022
0.15.0 Feb 26, 2022
0.10.0 Sep 25, 2021

#8 in #hazard

Download history 6/week @ 2023-11-05 23/week @ 2023-11-12 5/week @ 2023-11-19 78/week @ 2023-11-26 2/week @ 2023-12-03 4/week @ 2023-12-10 22/week @ 2023-12-17 57/week @ 2023-12-24 2/week @ 2023-12-31 4/week @ 2024-01-07 4/week @ 2024-01-14 20/week @ 2024-01-21 75/week @ 2024-01-28 3/week @ 2024-02-04 63/week @ 2024-02-11 436/week @ 2024-02-18

578 downloads per month

Apache-2.0

170KB
4K SLoC

Battlesnake Game Types

crates.io

A crate to represent game types in the game of battlesnake

Usage

The most common usage is decoding and encoding wire representation data:

use battlesnake_game_types::wire_representation::Game;
let g: Result<Game, _> = serde_json::from_slice(&body);

There are other useful tools that you can find better documented in the crate docs


lib.rs:

Types for working with battlesnake. The goal is to provide simulation tooling and fast representations that enable development of efficient minmax/MCTS. you will likely be most interested in the CellBoard type which implements all the traits necessary for minmax/MCTS and is much faster than using the wire representation, in our benchmarks, we see that our compact representation is on the order of about 33% faster for simulation than the wire representation.

Gnuplot not found, using plotters backend
compact start of game   time:   [2.7520 us 2.7643 us 2.7774 us]
                        change: [-9.0752% -8.5713% -8.0468%] (p = 0.00 < 0.05)
                        Performance has improved.

vec game start of game  time:   [4.1108 us 4.1303 us 4.1498 us]
                        change: [-12.869% -9.2803% -5.8488%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

compact late stage      time:   [14.098 us 14.152 us 14.209 us]

vec late stage          time:   [21.124 us 21.337 us 21.592 us]
Found 14 outliers among 100 measurements (14.00%)

Dependencies

~1.7–2.7MB
~54K SLoC