Socket
Book a DemoInstallSign in
Socket

go-game

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

go-game

Go game implementation in nodejs

latest
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

Go game on nodejs

Simple library that provides go game api to play with

Install

$ npm install go-game

Run & use

Basic usage

'use strict';

const go = require('go-game');

let game = new go(19);

// be sure to pass correct player on queue
// you can use game.currentPlayer to get one
game.playerTurn(go.BLACK, [0, 3]);
game.playerTurn(go.WHITE, [1, 3]);

Logging, back-ups and restores

// ...

console.log(game.printField());

// get current game in JSON format
let json = JSON.stringify(game);

// create instance from json
let prevGame = new go(json);
let oldGame  = new go(19).fromJSON(json);

Rollbacks

let turns = 2;
game.rollback(turns); // number of turns

Score

let score = game.score;
console.log(score[go.BLACK], score[go.WHITE]);

TODO

  • return ko rule
  • add final score calculation and game end
  • improve printField output

Keywords

go

FAQs

Package last updated on 29 Jun 2016

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.