@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)

    Install

    npm i @greenants/tic-tac-toe

    DownloadsWeekly Downloads

    2

    Version

    1.0.9

    License

    ISC

    Unpacked Size

    13.2 kB

    Total Files

    4

    Last publish

    Collaborators

    • greenants