Command Reference
| Command | Description | Example |
|---|---|---|
position [moves] | Set up position by playing moves | position 4433 |
display | Show the board | display |
go | Find the best move | go |
help | Show commands | help |
quit | Exit | quit |
position
Sets up a board position by playing a sequence of moves from an empty board. Syntax:moves(optional): A string of digits 1-7 representing column numbers. If omitted, resets to an empty board.
- Resets the board to empty
- Parses each character as a column number (1-7)
- Validates the move is legal
- Applies moves sequentially, alternating players
display
Shows the current board state with pieces and column numbers. Syntax:d
Example output:
X= Current player’s piecesO= Opponent’s pieces.= Empty cell- Numbers at bottom = Column numbers (1-7)
go
Analyzes the current position and finds the best move using the Negamax solver with alpha-beta pruning. Syntax:- Analysis lines: Shows the score for each legal move
- bestmove: The recommended column to play (1-7)
- score: The game-theoretic value (see Understanding Scores)
- result:
WIN,LOSE, orDRAW - Nodes analyzed: Number of positions evaluated
The solver checks for immediate winning moves first (source/src/main.cpp:93-98), providing instant results without deep analysis.
help
Displays a summary of available commands. Syntax:quit
Exits the Marlin engine. Syntax:exit
Example:
Error Handling
Marlin provides clear error messages for invalid input:Implementation Details
The command loop is implemented in source/src/main.cpp:145-199:- Reads lines from stdin
- Parses command and arguments
- Dispatches to handler functions
- Continues until
quitor EOF