Skip to content

SysCoder/tic-tac-toe-ai-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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', '' ] }
*/

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors