My goal is to make a script to finding the most and least likely move an engine will play, and then make a list it. I tried using the scores to make such a list, with the best score equalling the most likely move, but every time I got d ifferent scores for the same position.
After compering high-scoring moves with engine moves with the code
engine.play(board, chess.engine.Limit(time=0.100)), I noticed that the engine moves are totally different from the move that have the highest score on my outputs.
When I use the same version from my engine, but onvother sites that have the engine installed, I found that it chooses a different move from what my engine script chooses. I know that the engine is not just a bot who is repeating moves every time, but what's the best way make it as such?
Here is my code if you want to have a look:
import asyncio import chess #import chess.uci import chess.engine import chess.pgn import io from chess.engine import Cp, Mate, MateGiven #Let's try our code with the starting position of chess: fen = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' board = chess.Board(fen) #Now make sure you give the correct location for your stockfish engine file #...in the line that follows: e.g., /home/.../stockfish_6_x64 engine = chess.engine.SimpleEngine.popen_uci('/home/shar/Desktop/cheat detect python/stockfish-10-linux/Linux/stockfish_10_x64') if board.turn: print( 'White to move'); else: print( 'black to move'); counter = 0 while counter < 1: # do processing counter = counter + 1 result = engine.play(board, chess.engine.Limit(time=0.100)) print('the engine move',result.move) #getting legal moves scores part for el in board.legal_moves: pgn = io.StringIO(board.san(el)) thnwpgntofen = chess.pgn.read_game(pgn); nwinfo = engine.analyse(thnwpgntofen.board(),chess.engine.Limit(time=0.100)); print(board.san(el),nwinfo.get("score"), nwinfo.get("depth")) print("-------------------------");