1.0.4 • Published 1 year ago

ttt-board v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

TTT Board

A simple TicTacToe package for NodeJS, uses an Object Matrix type implementation for the board. Automatically takes care of turns and the board, simply move, get outputs and check if it's finished

Installation

$ npm install ttt-board

Running the tests

$ npm run test-ttt

Getting started

Basically just set it up

const ttt = new TTTBoard();

ttt.move("A", "2") // This uses an ABC 123 system, ABC for rows and 123 for columns, to move simply place ttt.move("A", "2") for example, top center, automatically turns to uppercase if lowercase
ttt.AImove() //Really is just a random move but it's cool to call it AI

let boardConfig = ttt.outputBoard() //Returns the board in it's config format, basically an object matrix
let boardImage = ttt.displayBoard() //Returns the board in a PNG format, just an image of the board
let boardASCII = ttt.writeBoard() //Returns the board in ASCII format (as a string), so you can write it to console! 

ttt.isFinished() //Returns true if the match has finished, to avoid making any more moves
ttt.turn() //Returns X or O depending on who's turn it is. When winning, ttt.turn() will output the winning letter
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago