nmrugg/stockfish.js

How to find multiple moves to consider?

Closed this issue · 2 comments

How do I make it so stockfish returns multiple moves after an evaluation. I am making a training program and at the moment am using stockfish to find the best move but want stockfish to instead return say the top 3 replies and play one at random.

I think you want the MultiPV option. You'll still only get one bestmove, but you'll get multiple depth n events, each starting with a different move in the variation line.

stockfish.postMessage('setoption name MultiPV value 3');

You need to examine the output stream. You can find an example of how to do it here using load_engine.js.