🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

battlesnake

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

battlesnake

A breezy developer experience for Battlesnake

0.1.0-beta.3
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

battlesnake

npm version

Stop worrying about networking and start focusing on your snake brain!

battlesnake is an SDK to help you build Battlensnakes quickly. It provides a simple API to create snakes, and respond to game events. It also handles plugins

Features

  • Complete types to catch some types of bugs before you deploy them
  • Docstrings for documentation you can see in your editor as you work
  • A plugin system to extend the functionality of the SDK
  • A simple event system to handle game events

Usage

If you're starting with a new snake, I recommend using the create-battlesnake snake generator to scaffold a new project. It uses the battlesnake package in the projects it creates.

The core component of the SDK is the BattleSnake class. You can import it as shown below:

import { BattleSnake } from 'battlesnake';

The BattleSnake class stores information about your snake, and spins up a server to handle requests from the Battlesnake game engine. Get started by creating an instance of the BattleSnake class:

const mySnake = new BattleSnake({
  apiversion: "1",
  author: "",
  color: "#888888",
  head: "default",
  tail: "default",
  version: "0.0.1",
});

From there,

Plugins

The BattleSnake class can take an array of plugins in its configuration. Plugins can hook into lifecycle events, and can help abstract behavior so that you don't have to write it manually, or manage it by hand.

Check out battlesnake-plugin-ngrok as an example of a plugin.

Feature requests and bugs

Please feel free to file feature requests and bugs at the issue tracker.

Keywords

battlesnake

FAQs

Package last updated on 17 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts