gomoku-manager

1.0.3 • Public • Published

A gomoku game manager.

Installation

$ npm install gomoku-manager --save

Getting started

    let Gomoku = require("gomoku-manager");
    let gomoku = new Gomoku(); 
    // let gomoku = new Gomoku([size]); 
    // You can also customize the chessboard size(default:15).

    let res = gomoku.place(x,y);

Coordinate system

|(0,0)|(0,1)|...|(0,size)| |-|-|-|-|-| |(1,0)| |...| |(size,0)|

Usage Guide

When you generate a new instance of Gomoku,it generates a chessboard and two players(0 and 1) internally.

You can call the 'place' function to place a chessman in the specified position.And it will return the result as appropriate.

  • When the parameter x or y exceed the boundary of chessboard,it will return { code: -1, message: "Out of size" }
  • When the place is occupied,it will return { code: -2, message: "Already occupied" }
  • When the game has been over.{ code: -3, message: "Game Stop" }
  • Normally,returns { code: 0, message: "ok", data: { player: player, place: { x: x, y: y } }}
  • Winner emerged and game over. { code: 1, message: "Game over", data: { winner: Number(0 or 1), result: Array } }

Readme

Keywords

Package Sidebar

Install

npm i gomoku-manager

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

5 kB

Total Files

4

Last publish

Collaborators

  • moonaneoc