@greenants/tic-tac-toe

1.0.9 • Public • Published

#Tic Tac Toe Engine

const game = require('tic-tac-toe')

game.setLogger((log) => console.log(log))

let board = game.newBoard()
let winner = undefined

while (!winner) {
    const move = game.calculateMove(board)
    console.log('move', move)

    if (!move) break

    board = game.setMove(board, move)
    console.log(game.draw(board))
    winner = game.getWinner(board)
}

console.log('winner', winner)

/@greenants/tic-tac-toe/

    Package Sidebar

    Install

    npm i @greenants/tic-tac-toe

    Weekly Downloads

    1

    Version

    1.0.9

    License

    ISC

    Unpacked Size

    13.2 kB

    Total Files

    4

    Last publish

    Collaborators

    • greenants