Socket
Socket
Sign inDemoInstall

gomoku-tools

Package Overview
Dependencies
9
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gomoku-tools

Tools for handling gomoku games


Version published
Weekly downloads
15
increased by87.5%
Maintainers
2
Install size
1.08 MB
Created
Weekly downloads
 

Readme

Source

#Gomoku Tools

This is a library to simplify common operation with gomoku board.

The plan is to make it work for renju and gomoku games, as well as with any other mnk game.

This library is currently in a very rough condition and a lot of things will get changed eventually.

Example:

This example works with 3x3 version of the game, but

    var tools = require('../gomoku-tools');
    
    var game = new tools.TicTacToe();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3           
     2           
     1           
    
    */
    
    game.moveTo('b2');
    console.log(game.ascii()); 
    /*
         A  B  C 
     3           
     2      x    
     1           
    
    */
    
    game.moveTo('a1', 'c1', 'a3', 'a2');
    console.log(game.ascii()); 
    /*
         A  B  C 
     3   o       
     2   x  x    
     1   o     x 
    
    */
    
    game.transform.clockwise();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3   o  x  o 
     2      x    
     1   x       
    
    */
    
    game.transform.counterClockwise();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3   o       
     2   x  x    
     1   o     x 
    
    */
    
    game.transform.vertical();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3   o     x 
     2   x  x    
     1   o       
    
    */
    
    game.transform.horizontal();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3   x     o 
     2      x  x 
     1         o 
    
    */
    
    game.transform.diagonalFromLeftTopToRightBottom();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3   o  x  o 
     2      x    
     1         x 
    
    */
    
    game.transform.diagonalFromLeftTopToRightBottom();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3   x     o 
     2      x  x 
     1         o 
    
    */
    
    game.transform.normalizeBasic();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3         x 
     2      x    
     1   o  x  o 
    
    */
    
    game.transform.diagonalFromLeftTopToRightBottom();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3   o     x 
     2   x  x    
     1   o       
    
    */
    
    game.transform.normalizeBasic();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3         x 
     2      x    
     1   o  x  o 
    
    */
    
    game.transform.clockwise();
    game.transform.vertical();
    game.transform.normalizeBasic();
    console.log(game.ascii()); 
    /*
         A  B  C 
     3         x 
     2      x    
     1   o  x  o 
    
    */
    

All the methods above will work with gomoku version as well:

    var tools = require('../gomoku-tools'); 
    var game = new tools.Gomoku();

Tests

Run tests: nmp test

Keywords

FAQs

Last updated on 03 Oct 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc