1.0.9 • Published 7 years ago

tic-tac-toe-ai-engine v1.0.9

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

Build Status Build Status

tic-tac-toe-ai-engine

Stateless Tic Tac Toe engine. Given a position the engine will give next best move, winner given perfect play, and the number of moves left with perfect play.

Test in browser

Tic Tac Toe AI Engine in Runkit

Example:

var ticTacToeAiEngine = require("tic-tac-toe-ai-engine");

var gameState = ['X', '', '', 'O', '', '', 'X', 'O', ''];
console.log(ticTacToeAiEngine.computeMove(gameState));

/*
Output:
  { winner: 'X',
    depth: 3,
    nextBestGameState: [ 'X', '', 'X', 'O', '', '', 'X', 'O', '' ] }
*/
1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago