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.

get_book_move()[source]

Get move from opening book.

Paramètres

board (chess.Board) – Board to get move.

Renvoie

A random move from the opening book?

Type renvoyé

Optional[chess.Move]

get_syzygy(board: chess.Board) → tuple[source]

Get a move from Syzygy tablebases.

Paramètres

board (chess.Board) – Board to get best move and evaluation.

Renvoie

The evaluation from Syzygy tablebases and the best move.

Type renvoyé

tuple[int, chess.Move]

minimax_nn(board: chess.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: chess.Board)[source]

Select best moves in board.

search(board, depth, maximize_white, limit_time)[source]

Search best move (Minimax from wikipedia).

tb_update()[source]

Update hash tables from file.

Renvoie

Nothing.

Type renvoyé

None

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.

Paramètres
  • position (chess.Board) – Position to evaluate.

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

Renvoie

White’s castling advantage as centipawns.

Type renvoyé

int

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

Evaluate center occupation.

Paramètres

position (chess.Board) – Position to evaluate.

Renvoie

White’s center advantage as centipawns.

Type renvoyé

int

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

Evaluate pieces developpement and activity in the given position.

Paramètres

position (chess.Board) – Position to evaluate.

Renvoie

White’s material advantage as centipawns.

Type renvoyé

int

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

Evaluate king protection score of White in the given position.

Paramètres

position (chess.Board) – Position to evaluate.

Renvoie

White’s material advantage as centipawns.

Type renvoyé

int

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

Evaluate material advantage of White in the given position.

Paramètres

position (chess.Board) – Position to evaluate.

Renvoie

White’s material advantage as centipawns.

Type renvoyé

int

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

Evaluate position and return white’s advantage in centipans.

Paramètres
  • position (chess.Board) – Position to evaluate.

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

Renvoie

White’s advantage as centipawns.

Type renvoyé

int

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

Wrapper for evaluating move.

Paramètres
  • position (chess.Board) – Position to evaluate.

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

Renvoie

White’s advantage as centipawns.

Type renvoyé

int

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

Wrapper for evaluating position.

Paramètres

position (chess.Board) – Position to evaluate.

Renvoie

White’s advantage as centipawns.

Type renvoyé

int

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

Evaluation: Check paseed pawns.

Paramètres
  • board (chess.Board) – Board.

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

Renvoie

Bonus points.

Type renvoyé

int

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

Evalutaion function number 2.

Paramètres

board (chess.Board) – Board to evaluate.

Renvoie

Evaluation in centipawns.

Type renvoyé

int

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

Evaluate position.