t9e

    1.0.9 • Public • Published

    Build Status devDependencies Status

    t9e

    t9e (tic-tac-toe) is a Tic-Tac-Toe board generator and solution checker.

    Boards of arbitrary size are supported. Boards should be kept below ~1000 rows and columns on a side for code to remain performant.

    Currently three operations are supported:

    1. Generate a Tic-Tac-Toe board of arbitrary size.
    2. Test the win state of a Tic-Tac-Toe board of arbitrary size.
    3. Test whether any cell of a Tic-Tac-Toe board is empty, so play may continue.

    Why?

    This project began in response to a Hacktoberfest help request on tictactoe-server. The ticket asked for the solution checker to use ES6 syntax. My solution to the problem interested me enough to spin off the code.

    But Senpai...Why?

    Because.

    Installation

    npm install t9e
    

    Testing

    npm run test
    

    Usage

    To generate a board (a square multidimensional grid) of a given size:

    const t9e = require('t9e');
    t9e.board(3, '-'); // [ ['-', '-', '-'], ['-', '-', '-'], ['-', '-', '-'] ]

    To validate the state of a given board:

    const t9e = require('t9e');
     
    const board = [
        ['X', 'O', 'X'],
        ['O', 'X', 'O'],
        ['O', 'O', 'X']
    ];
     
    t9e.check('X', board); // true
    t9e.check('O', board); // false

    To test whether any cell of the board is empty (falsy):

    const t9e = require('t9e');
     
    const board = [
        ['X', 'O', 'X'],
        ['O', 'X', null],
        ['O', 'O', 'X']
    ];
     
    t9e.anyEmpty(board); // true

    TODO

    • Per cell state checking. Given the coordinates of a cell, check the cell based upon its row and column (and intersecting diagonal if applicable).

    Copyright

    Copyright (c) 2016 Mark Grealish. See LICENSE for details.

    Keywords

    none

    Install

    npm i t9e

    DownloadsWeekly Downloads

    2

    Version

    1.0.9

    License

    MIT

    Last publish

    Collaborators

    • bhalash