Skip to content

parses output from stockfish.js and gets the best move

Notifications You must be signed in to change notification settings

dax006/stockfishJSparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 

Repository files navigation

stockfishJSparser

parses output from stockfish.js and gets the best move

Usage:

In your HTML:

include this script, stockfishJSparser.js

requires stockfish.js in the folder 'js'.

Call getBestMoves(callbackFunction), Where callbackFunction is the name of any function you created. You can name it whatever you want. When Stockfish finishes its analysis, that function will fire.

The function accepts one paramter, 'bestmoves'. Bestmoves is an array of strings. The number of best moves returned is a variable set at the top of stockfishJSparser.js. The default is 1. Feel free to modifiy it. The strings are moves in the form of 'a3-a4'. There is no extended notation such as +, !, ?, or x (as in a3xb4).

Example

<script src='js/parseStockfish.js'></script>
<script>

function callbackFunction(bestmoves){ console.log(bestmoves[0]); }

getBestMoves(callbackFunction); //must pass in the name of a function that will be the callback when moves are available </script>

To see it in use, look at http://johnktejik.info/share/chessapp/

shareeditdeleteflag

About

parses output from stockfish.js and gets the best move

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published