1.0.3 • Published 5 years ago

gomoku-manager v1.0.3

Weekly downloads
15
License
ISC
Repository
-
Last release
5 years ago

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 } }
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago