crocrodile.engine - Engine

MyEngine Engine base.

Base engine

class crocrodile.engine.EngineBase(name, author, board=Board('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'))[source]

Engine base.

evaluate(board)[source]

Evaluate position.

minimax_nn(board, depth, maximimize_white, limit_time)[source]

Minimax algorithm from Wikipedia with NN.

minimax_std(board, depth, maximimize_white, limit_time)[source]

Minimax algorithm from Wikipedia with NN.

nn_select_best_moves(board)[source]

Select best moves in board.

search(depth, board)[source]

Search best move (Minimax from wikipedia).

crocrodile.engine.printi(*args)[source]

Debug mode printer.

crocrodile.engine.evaluate - Evaluation

Crocrodile Evaluation.

Evaluation: Evaluate position.

class crocrodile.engine.evaluate.Evaluator[source]

Base class for evaluation (v2).

static eval_castling(position: chess.Board, move: chess.Move) int[source]

Evaluate castling in the given position.

Parameters
  • position (chess.Board) – Position to evaluate.

  • move (chess.Move) – Move to evaluate.

Returns

White’s castling advantage as centipawns.

Return type

int

static eval_developpement(position: chess.Board)[source]

Evaluate pieces developpement and activity in the given position.

Parameters

position (chess.Board) – Position to evaluate.

Returns

White’s material advantage as centipawns.

Return type

int

static eval_king_protection(position: chess.Board) int[source]

Evaluate king protection score of White in the given position.

Parameters

position (chess.Board) – Position to evaluate.

Returns

White’s material advantage as centipawns.

Return type

int

static eval_material(position: chess.Board) int[source]

Evaluate material advantage of White in the given position.

Parameters

position (chess.Board) – Position to evaluate.

Returns

White’s material advantage as centipawns.

Return type

int

evaluate(position: chess.Board, move: chess.Move = Move.from_uci('0000')) int[source]

Evaluate position and return white’s advantage in centipans.

Parameters
  • position (chess.Board) – Position to evaluate.

  • move (chess.Move) – Move who will be played.

Returns

White’s advantage as centipawns.

Return type

int

evaluate_move(position: chess.Board, move: chess.Move) int[source]

Wrapper for evaluating move.

Parameters
  • position (chess.Board) – Position to evaluate.

  • move (chess.Move) – Move to evaluate.

Returns

White’s advantage as centipawns.

Return type

int

evaluate_position(position: chess.Board) int[source]

Wrapper for evaluating position.

Parameters

position (chess.Board) – Position to evaluate.

Returns

White’s advantage as centipawns.

Return type

int

crocrodile.engine.evaluate.check_passed_pawns(board: chess.Board, color: bool) int[source]

Evaluation: Check paseed pawns.

Parameters
  • board (chess.Board) – Board.

  • color (bool) – Color to add bonus (True is white).

Returns

Bonus points.

Return type

int

crocrodile.engine.evaluate.evaluate2(board: chess.Board) int[source]

Evalutaion function number 2.

Parameters

board (chess.Board) – Board to evaluate.

Returns

Evaluation in centipawns.

Return type

int

crocrodile.engine.evaluate.old_evaluate(board: chess.Board)[source]

Evaluate position.