main.cpp

CLI entry point — argument parsing and run-mode dispatch.

Dispatches the four run modes (UCI, physical, simulation, dry run). See the overview for how a mode selects a board backend.

*       ,  ,
*           \\ \\
*           ) \\ \\    _p_
*            )^\))\))  /  *\      KIRIN CHESS ENGINE v0.3
*             \_|| || / /^`-'
*    __       -\ \\--/ /          Author:      Strydr Silverberg
*  <'  \\___/   ___. )'                        Colorado School of Mines, Class of 2026
*       `====\ )___/\\
*            //     `"            Hardware:    Colin Dake
*            \\    /  \
*            `"
*

Project overview

Kirin is the computational engine powering an autonomous chess system designed to deliver a complete single-player experience. By integrating intelligent move generation with a physical board capable of independent piece manipulation, the system eliminates the need for a human opponent while preserving the tactile satisfaction of over-the-board play.

Funding and acknowledgments

2026 Colorado School of Mines ProtoFund recipient. Team: Strydr Silverberg, Colin Dake.

This prototype represents the practical application of engineering principles and computer science fundamentals developed through our coursework at the Colorado School of Mines.

Enums

enum RunMode

Values:

enumerator MODE_UCI
enumerator MODE_PHYSICAL
enumerator MODE_SIMULATION
enumerator MODE_DRYRUN
enumerator MODE_OLED_TEST
enumerator MODE_SENSOR_DIAG
enumerator MODE_GPIO_LED
enumerator MODE_TUNE_PROBE
enumerator MODE_BOOT

Functions

void printHelp()
void runPhysicalMode(const char *port, bool headless = false)
void runSimulationMode(const char *personalityId = nullptr, const char *oddsName = nullptr)
void runDryRunMode(int maxMoves, int searchDepth)
void runOledTestMode()
void runSensorDiagnosticMode(int channelHoldMs)
void runGpioLedMode(int gpioPin, int holdMs)
void runTuneProbeMode(const char *port)
static void runSensorGameLoop(GameController &controller, bool engineWhite, DisplayController *display)
static bool promptForBoardRecovery(GameController &controller, DisplayController *display)
static bool finalizePhysicalEngineMove(GameController &controller, int engineMove, DisplayController *display)
static std::string moveToUciString(int move)
static void showDisplay(DisplayController *display, DisplayStatus status, const std::string &detail = "", const std::string &line2 = "", const std::string &line3 = "")
static bool readPhysicalInput(char *input, int size, ButtonController *buttons, DisplayController *display, GameController &controller, bool &shouldQuit, bool allowTerminalInput = true, bool allowIdleExit = true)
static bool handleIdleButton(ButtonEvent event, DisplayController *display, GameController &controller, char *command, int commandSize, bool &shouldQuit, bool allowIdleExit = true)
static bool pathExists(const char *path)
static std::string resolvePhysicalPort(const char *requestedPort)
static void printUciMove(int engineMove)
static const char *describeMoveType(int engineMove)
static const char *pieceNameFromEngine(int piece)
int main(int argc, char *argv[])