Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

smartgamer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartgamer

Use smartgame objects created from SGF (Smart Game Format) files.

latest
Source
npmnpm
Version
0.1.5
Version published
Maintainers
1
Created
Source

smartgamer Build Status

So you've used smartgame to turn your SGF file into a friendly JavaScript object, have you? Now you need a smartgamer to let you navigate and manipulate that smartgame.

Installation

For most projects, you'll just want to install smartgamer locally and add it to your project's dependencies in package.json:

$ npm install --save smartgamer

If you want (for whatever reason) to use smartgame anywhere, you can install it globally.

$ npm install -g smartgamer

Usage

var sgf = require('smartgame');
var smartgamer = require('smartgamer');
var fs = require('fs');

// Grab an SGF file from somewhere
var example = fs.readFileSync('sgf/example.sgf', { encoding: 'utf8' });

var gamer = smartgamer(sgf.parse(example));

// Go to a specific move
gamer.goTo(4);

// Navigate between moves
gamer.next();
gamer.previous();

// Chain navigation together
gamer.next().next();
gamer.last().previous();
gamer.goTo(4).next(1);

// Get / set comments
gamer.comment();
gamer.comment('Losing move!');

// Get the current node
gamer.node();

// Get the modified smartgame
var newSGF = smartgame.generate(gamer.getSmartgame());
fs.writeFileSync('new-example.sgf', newSGF, { encoding: 'utf8' });

Methods

Coming soon! Until then, just checkout index.js. If you care about having this documented, please let me know and I'll make it happen.

License

MIT

Keywords

smartgame

FAQs

Package last updated on 10 Jan 2017

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