engine.py

examples/pychess/engine.py

Engine wiring — connects entropic wrapper to chess game loop.

Owners: @tvanfossen

create_engine

ChessEngine engine.create_engine()

Instantiate EntropicEngine with pychess config.

examples/pychess/engine.py:44

Show on the map →

Called by game_loop

Calls none

Source · 11 lines
def create_engine() -> ChessEngine:
    """Create and configure the engine from local config.

    @brief Instantiate EntropicEngine with pychess config.
    @version 2
    """
    config_path = EXAMPLE_ROOT / "data" / "default_config.yaml"
    engine = EntropicEngine(config_path=str(config_path))
    return ChessEngine(engine=engine, board=chess.Board())

Activity · 3 steps
lines 50–50config_path = EXAMPLE_ROOT / "data" / "default_config.yaml"lines 51–51engine = EntropicEngine(config_path=str(config_path))lines 52–52return ChessEngine(engine=engine, board=chess.Board())

Flows

shutdown

None engine.shutdown(ChessEngine chess_engine)

Destroy the C engine handle.

examples/pychess/engine.py:152

Show on the map →

Called by game_loop

Calls none

Source · 7 lines
def shutdown(chess_engine: ChessEngine) -> None:
    """Clean shutdown of entropic engine.

    @brief Destroy the C engine handle.
    @version 2
    """
    chess_engine.engine.destroy()

1 more lines, not shown

Activity · 1 steps
lines 158–158chess_engine.engine.destroy()

Flows