UNPKG

hathora-et-labora-game

Version:

Game logic reducer for Uwe Rosenberg's Ora et Labora

12 lines (10 loc) 362 B
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) )