main.cpp¶
examples/pychess/main.cpp
@file main.cpp @brief PyChess — play chess against a local LLM via the entropic C API.
Owners: @tvanfossen
game_loop
static void game_loop(entropic_handle_t handle)
Run the interactive chess game loop.
examples/pychess/main.cpp:430
Source · 11 lines
static void game_loop(entropic_handle_t handle)
{
GameState state{};
init_board(state);
std::printf("PyChess — You are White, AI is Black.\n");
std::printf("Enter moves in UCI notation (e.g. e2e4). Type 'quit' to exit.\n");
display_board(state.board);
while (play_human_turn(state) && play_ai_turn(handle, state)) {
/* continue until quit or error */
}
}Activity · 6 steps
Flows
main
int main(int argc, char *argv[])
Entry point.
examples/pychess/main.cpp:477
Source · 6 lines
int main(int argc, char* argv[])
{
(void)argc;
(void)argv;
return run_game();
}Activity · 3 steps
Flows
run_game
static int run_game()
Run the pychess game.
examples/pychess/main.cpp:455
Source · 11 lines
static int run_game()
{
entropic_handle_t handle = setup_engine(".pychess");
if (!handle) {
return EXIT_FAILURE;
}
game_loop(handle);
entropic_destroy(handle);
std::printf("Goodbye!\n");
return EXIT_SUCCESS;
}