Skip to content

steveLeVesconte/go-game-move-processor

Repository files navigation

go-game-move-processor

This package evaluates individual actions in a go game to decide on validity and to award captured stones (points).

Prerequisites

This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v
6.4.1
v8.16.0

Table of contents

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installation

BEFORE YOU INSTALL: please read the prerequisites

Start with cloning this repo on your local machine:

$ git clone https://github.com/steveLeVesconte/go-game-move-processor.git
$ cd go-game-move-processor

To install and set up the library, run:

$ npm install @two-way-press/go-game-move-processor

Usage

Using the npm package in your project.

Follow the installation instructions above and then submit Submissions to the evaluateSubmission function to get a result.

Refer to gameReferee.test.ts for many examples of composing well-formed submissions and interpreting results.


This package is used by a client app to evaluate go game moves. The client app submits a Submission to the function evaluateSubmission which returns a SubmissionResult.

index.ts exposes 3 types:

StonePlay the individual move such as "white stone at location 1A".
Submission all the information needed to evaluate a game move including a past game state for evaluation of Ko rule compliance.
BaseSubmissionResult the referee's determination of the legality of the move and the resulting game state including captured stones and new board state
and 2 syncronous functions:
evaluateSubmission a pure synchronous function that accepts a Submission and returns a BaseSubmissionResult.
stringBoardToArray a pure synchronous function that accepts a serialized representation of a go board state and converts it to a two dimensional array (19x19) of letters representing stones on the board and their locations.

Running the tests

$ npm test

Building a distribution version

Update the version number in package.json Update the "name" in package.json with the desired name for your NPM repository project.

Example: @two-way-press/go-game-move-processor (but I own that name, so it will not work for you).

$ npm run build

This task will create a distribution version of the project inside your local dist/ folder

Deploying a version to the NPM repository

$ npm publish --access public

This will make the package available for download.

Built With

  • TypeScript
  • Vite
  • viTest
  • Love

Authors

  • Steve LeVesconte

License

MIT License © Steven LeVesconte

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages