How to use stockfish - 4 common examples

To help you get started, we’ve selected a few stockfish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zhelyabuzhsky / stockfish / tests / stockfish / test_models.py View on Github external
def test_stockfish_constructor_with_custom_params(self):
        stockfish = Stockfish(parameters={"Skill Level": 1})
        assert stockfish.get_parameters() == {
            "Write Debug Log": "false",
            "Contempt": 0,
            "Min Split Depth": 0,
            "Threads": 1,
            "Ponder": "false",
            "Hash": 16,
            "MultiPV": 1,
            "Skill Level": 1,
            "Move Overhead": 30,
            "Minimum Thinking Time": 20,
            "Slow Mover": 80,
            "UCI_Chess960": "false",
        }
github saikrishna-1996 / deep_pepper_chess / game / generate_data.py View on Github external
def get_groundtruth(self):
        feature_batch = []
        targets_batch = []
        board_positions = self.get_board_position()
        shuffle(board_positions)
        print("done shuffling")
        print("generating evaluations on {} board positions...".format(len(board_positions)))
        # stockfish = Stockfish()

        
        for index, board_position in enumerate(board_positions):
        	print(index)
        	stockfish = Stockfish()
        	feature_batch.append(board_to_feature(board_position))
        	targets_batch.append(stockfish.stockfish_eval(board_position, 10))
        	stockfish.kill_me()
        feature_arr = np.asarray(feature_batch)
        targets_arr = np.asarray(targets_batch)
        np.save('features.txt', feature_arr)
        np.save('values.txt', targets_arr)
github saikrishna-1996 / deep_pepper_chess / game / pretrain.py View on Github external
def pretrain(model):
    feature_batch = []
    targets_batch = []
    board_positions = get_board_position()
    shuffle(board_positions)
    print("Pretraining on {} board positions...".format(len(board_positions)))
    stockfish = Stockfish()

    for batch in range(Config.PRETRAIN_EPOCHS):
        for index, board_position in enumerate(board_positions):
            if (index + 1) % Config.minibatch_size != 0:
                feature_batch.append(board_to_feature(board_position))
                targets_batch.append(stockfish.stockfish_eval(board_position, 10))
            else:
                feature_batch = torch.FloatTensor(feature_batch)
                targets_batch = Variable(torch.FloatTensor(targets_batch))
                do_backprop(feature_batch, targets_batch, model)
                feature_batch = []
                targets_batch = []
        print("Completed batch {} of {}".format(batch, Config.PRETRAIN_EPOCHS))

stockfish

Wraps the open-source Stockfish chess engine for easy integration into python.

MIT
Latest version published 5 months ago

Package Health Score

70 / 100
Full package analysis

Popular stockfish functions