def bot_move(self): stfish = Stockfish('stockfish') stfish.set_fen_position(self.fen()) if self.board.turn: stfish.depth = self.white_bot_power else: stfish.depth = self.black_bot_power move = stfish.get_best_move() return self.make_move(move)
""" Before running do pip install stockfish to get the stockfish python interface """ from stockfish import Stockfish stockfish = Stockfish() stockfish.set_position(['e2e4', 'e7e6']) stockfish.depth = 20 print(stockfish.get_best_move()) print(stockfish.is_move_correct('a2a3'))