thaw-reversi-engine.ts
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

thaw-reversi-engine.ts

A Node.js Reversi (Othello) game engine with alpha-beta pruning and a heuristic, packaged for npm.

build status npm version npm total downloads known vulnerabilities maintainability test coverage tested with jest code style: prettier license

Git Installation Instructions

git clone https://github.com/tom-weatherhead/thaw-reversi-engine.ts.git
cd thaw-reversi-engine.ts
npm run all

npm Installation Instructions

npm install [--save] thaw-reversi-engine.ts

Sample Usage of the npm Package

let engine = require('thaw-reversi-engine.ts');
 
let boardString = engine.createInitialBoard();
let player = 'X';
let maxPly = 5;
 
try {
    let result = engine.findBestMove(boardString, player, maxPly);
 
    console.log(result);
} catch (error) {
    console.error('engine.findBestMove() threw an exception:', error);
}

Output: E.g.

{
    bestRow: 4,
    bestColumn: 2,
    bestScore: 3,
    bestMoves: [
        { row: 2, column: 4 },
        { row: 3, column: 5 },
        { row: 4, column: 2 },
        { row: 5, column: 3 }
    ]
}

License

MIT

Package Sidebar

Install

npm i thaw-reversi-engine.ts

Weekly Downloads

4

Version

0.3.0

License

MIT

Unpacked Size

30.8 kB

Total Files

19

Last publish

Collaborators

  • tom-weatherhead