New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@typinghare/board-game-clock-core

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typinghare/board-game-clock-core

Board game clock core.

latest
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

Board Game Clock Core

Get Started

Create a game

import { Game, Player, TimeControl } from '@typinghare/board-game-clock-core'

const ROLE_A = 'A'
const ROLE_B = 'B'

// Create a game with two players (A & B), applying default time control and default player
const game = new Game([ROLE_A, ROLE_B], new TimeControl(), Player)

// Start the game
game.start()

// Get players
const playerA = game.getPlayer(ROLE_A)
const playerB = game.getPlayer(ROLE_B)

// Player A presses, player B's timer runs
playerA.press()

// Set onStop callback function
game.onStop = function(stopper, timeUpRole) {
    console.log(`Game stops. Player ${stopper} stops the game.`)
    if (timeUpRole) {
        console.log(`Player ${timeUpRole} has run out of time.`)
    }
}

// Stop the game
game.stop()

Two-Player Game

import { Player, TimeControl, TwoPlayerGame } from '@typinghare/board-game-clock-core'

// Create a two-player game
const game = new TwoPlayerGame(new TimeControl(), Player)

Use General Two-player Game

Use Simulator

Customize a New Game

Keywords

board game

FAQs

Package last updated on 25 Jul 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