r/ComputerChess • u/OldWolf2 • Mar 29 '19
Question Commandline options for Stockfish?
Is there a reference for which commandline options Stockfish accepts? I could not find anything by googling.
1
u/Der_Bradly Mar 29 '19
As others have said, stockfish uses the UCI protocol. The website that normally lists the specification is down, but here's a link to an archived version of it. Hopefully this is helpful, and if you have any questions about the protocol specifics feel free to reply!
1
u/OldWolf2 Mar 29 '19
I'm asking about the commandline options, not the UCI commands.
→ More replies (1)
3
u/IMJorose Mar 29 '19
SF implemented the UCI protocol, so if you are running the program from command line you can call the "uci" command to see a list of options for it. "setoption Name <option-name> Value <option-value>" can then be used to set the respective options after startup and I assume you could call them at startup as well, but I don't know for sure off the top of my head.
1
u/gray-wolf718 May 17 '22
I'm a UK club-level chess player. i really need an analysis of my otb match games . i only heard of stockfish as a freebie download about 2 days ago.
i'm on a windows pc, so i appreciate those examples by Spill_the_Tea. i get the gist of his linux examples, my windows pc is probably going to allow something similar. Looking forward to getting his examples to show a chess board image.
1
u/Pristine_Tip7902 Aug 07 '22
bench
stockfish is an engine, and designed to be controlled by GUI programs rather than run directly by a human. You can run it directly, as described above. But the only people who do this are stockfish developers themselves, debugging the engine. For a list of GUIs which you can use to run stockfish in a more human-friendly manner, see https://www.chess.com/forum/view/chess-equipment/best-free-guis-to-run-stockfish-13-on-windows-pc
5
u/Spill_the_Tea Mar 30 '19 edited Apr 06 '19
Given your replies to other's comments, you either don't understand that uci parameters are command-line options, or you don't know how to use uci parameters / protocol in commandline?
If it is the later, this is a common question, which I will answer generically (to apply to any uci compatible chess engine), and at the end provide additional commands that are mostly exclusive to stockfish (which is in addition to standard uci protocol):
Step 1: Initiate your chess engine executable in command line (on mac/unix this is ./stockfish)
Step 2: Type: isready (this step isn't necessary for stockfish, but some engines do (e.g. Discocheck and Quazar)
Output: readyok
Step 3: Type 'uci'
The Output, should provide the engine ID, version number, and author information, followed by a list of all supported uci options, such as Hash, Threads, MultiPV, Ponder, etc...
This also shows you the default setting for each parameter
The uci string always ends on a newline 'uciok'
Sample output from stockfish 10 for reference: here
Step 4: How to change a supported UCI Option (Generic Formula)
setoption name [supported uci option] value [value you want to change it to]e.g. to change hash size to 1024 MB and use 2 threads, type the following into commandline:
setoption name hash value 1024setoption name threads value 2*Note: that the option name is case insensitive, so you could write instead : setoption name HaSh value 1024, and get the same results
Step 5: Set or change the position
How to set the Starting Position
position startposHow to Move (e.g. move pawn to e4 from starting position)
position startpos moves e2e4Note that you must use uci notation (a variant of long algebraic notation) of moves which only includes the square it comes from and square it goes to;
In order to castle kingside, you must use the notation e1g1 (or e8g8), to castle queenside : e1c1 (e8c8)
How to set a Position with a specific fen string
position fen [fen string here]e.g. change position to this fen : 4kb1r/p2rqppp/5n2/1B2p1B1/4P3/1Q6/PPP2PPP/2K4R w k - 0 14
position fen 4kb1r/p2rqppp/5n2/1B2p1B1/4P3/1Q6/PPP2PPP/2K4R w k - 0 14How to make a move from a specific fen position (using above example)
position fen 4kb1r/p2rqppp/5n2/1B2p1B1/4P3/1Q6/PPP2PPP/2K4R w k - 0 14 moves h1d1Step 6: Search / Analysis... Type 'go', followed by any number of commands:
infinite
depth [ply depth]
movetime [time in ms]
Note: there are other options available, but they really aren't useful without a gui (such as setting movestogo, winc, binc)
Stockfish Specific Commands (i.e. not portable to other uci engines)
Stockfish can display a diagram of the current position
Type 'd' into command line
Stockfish can display a static eval (and breakdown of the position)
Type 'eval' into command line
Benchmark Testing
type 'bench'
PERFT
type: 'go perft [ply depth]'