0.8.2 • Published 9 months ago

dark-forest-game v0.8.2

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
9 months ago

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.
0.8.2

9 months ago

0.8.1

9 months ago

0.8.0

9 months ago

0.7.2

9 months ago

0.7.1

9 months ago

0.7.0

9 months ago

0.6.1

9 months ago

0.6.0

9 months ago

0.5.0

9 months ago

0.4.3

9 months ago

0.4.2

9 months ago

0.4.1

9 months ago

0.4.0

9 months ago

0.3.0

9 months ago

0.2.0

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago