@mrlhumphreys/jgo

Go game state and move validation

Usage no npm install needed!

<script type="module">
  import mrlhumphreysJgo from 'https://cdn.skypack.dev/@mrlhumphreys/jgo';
</script>

README

JGo

A go game state and validation library written in Javascript.

Installation

Install via npm:

$ npm install @mrlhumphreys/jgo

Usage

ES5:

  var Match = require('@mrlhumphreys/jgo').Match;

ES6:

  import { Match } from '@mrlhumphreys/jgo'

Initialize a new match object:

  var match = new Match({
  });

Serialize match object:

  match.asJson;

Make a move

  match.touchPoint(19, 1); // place a stone at point 19 for player 1

Pass the turn

  match.touchPass(1); // pass the turn for player 1

Get winner

  match.winner;

Development

After checkout out the repo, run npm install to install dependencies. Run npm build to transpile ES6 to ES5 into the lib directory. Run npm test to run the tests.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mrlhumphreys/jgo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The module is available as open source under the terms of the MIT License.