uno-lib
v0.1.0
Published
A library providing an API for playing Uno.
Maintainers
Readme
Uno-lib
A library providing a framework for building Uno games in TypeScript.
Installation
npm install uno-libQuick Start
import {
Game,
ComputerPlayer,
CardDeck,
LogLevel,
RandomGenerator,
HumanPlayer
} from 'uno-lib'
const game = new Game<ComputerPlayer | HumanPlayer>({
deck: new CardDeck(),
rng: new RandomGenerator(0),
logLevel: LogLevel.INFO,
})
const p0 = new HumanPlayer({
name: 'Human',
gameContext: game.getContext(),
})
const p1 = new ComputerPlayer({
name: 'Computer 1',
gameContext: game.getContext(),
})
const p2 = new ComputerPlayer({
name: 'Computer 2',
gameContext: game.getContext(),
})
;(async () => {
const players = [p0, p1, p2]
await game.step(null, players)
await game.step(null, players)
await game.step(null, players)
})()