hathora-et-labora-game
Version:
Plays Uwe Rosenberg's Ora et Labora for the Hathora engine. It reduces a list of moves into a board game state.
12 lines (10 loc) • 362 B
text/typescript
import { join, map, pipe, reduce, reject, split } from 'ramda'
import { GameState, initialState, reducer } from '.'
export const spiel = pipe(
join(''),
split('\n'),
map((s) => s.trim()),
reject((s) => s === ''),
map((s: string) => s.split(' ')),
reduce((state: GameState | undefined, command: string[]) => reducer(state!, command), initialState)
)