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

dark-forest-game

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dark-forest-game

Dark Forest board game logic

0.8.2
latest
npm
Version published
Weekly downloads
37
640%
Maintainers
1
Weekly downloads
 
Created
Source

Version Tests Coverage Downloads License

Dark Forest Game Logic Library

This is a state engine for playing a game of Dark Forest. I'm working on a UI for this, but at a minimal level every client and player should agree on the rules expressed by these state transforms. Keeping state-transition logic separate from UI should also make it simpler to build an offline trainer algorithm to develop a model to play the game against.

Each game state should start out with a state

import { initialState, GameState } from 'dark-forest-game'

const s0: GameState = initialState

initialState is the root game state that all games begin from. From here, any number of moves can be done, and the proper order of which is specified by the game itself, but it must conform to this flow, where any given string will process into another GameState.

import { reducer, GameState } from 'dark-forest-game'

const s1 = reducer(s0, ['START', 10]) as GameState
// create player 0 at sol 8
const s2 = reducer(s1, ['SPAWN', 0, 8]) as GameState
// create player 1 at sol 4
const s2 = reducer(s1, ['SPAWN', 1, 4]) as GameState

  • completion - a list of strings which could be the prefix of the next command from the user.
  • partial - The current list of params for the current move. "" is included in this list, then the current partial command could be sent as-is. If this list is empty, the given partial command is invalid.

Keywords

boardgame

FAQs

Package last updated on 19 Aug 2023

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