DOWNLOAD LINK GATHER AT THE END OF THIS CONTENT
If you’ve been playing chess for a while, you might have heard about Stockfish, the chess AI that eats chess grandmasters for breakfast, lunch, and the evening snacks after dinner. This guide shows how to make it work on your desktop computer!
Good to know: Are you a social gamer? Take a look through these online board games you can play with your friends[1].
What Is Stockfish?
Stockfish is more of a chess engine than an AI, and is among the strongest ones in the world[2]. With it, you can find the best moves from any position – as long as you give it time to process the ongoing game.
It’s also among the most popular, partly because it’s free and open source. The only thing that seems on par with it is Dragon[3], but that one costs money to use. When you’re training for tournaments or trying to figure out the best move to all kinds of chess puzzles, Stockfish is going to be your best friend.
It’s good to remember that Stockfish is a command line program, so you will need the Windows Command Prompt[4] or Linux Terminal[5] to use it.
How Chess Engines Like Stockfish Work
Chess engines (or chess AI, if you will) are much closer to password crackers than you might think.
When a chess engine like Stockfish thinks, it actually brute forces through all the combinations of legal moves until it finds the one that leads to the closest route to a mate. That’s how they rate how strong (or weak) your move is – a move that leads to checkmate in four turns is better than another move that requires eight turns.
As there are too many moves for Stockfish to go through, it will literally require days until it sees everything from 18 turns to after 1e4. That’s why you have to tell it how long it should think. It keeps track of the best move it has found so far, then picks that move when it reaches the time limit.
Chess GUIs that use Stockfish and other chess engines also have a ponder feature. It makes the engine think of a move while you’re thinking of your next move. This makes for a seamless play – your opponent will immediately start its next move after you make yours.
Good to know: if you like playing AI games, check out AI Dungeon[7].
How to Download Stockfish
- Download Stockfish 15.1 from the official Stockfish website[8]. On Linux, you can use
sudo apt install stockfish
instead. Be sure to update apt[9] first to get the latest version.
Note: there are two versions: AVX2 and POPCNT. In most newer computers and laptops, AVX2 should work. Only use POPCNT if it doesn’t.
- On Windows, you should get a ZIP file after clicking the download link. Extract the file and run the EXE file from the folder.
- If you’re on Linux, run the terminal and enter
stockfish
.
Tip: Want to improve your gaming performance on Linux? Try GameMode.[10]
Playing with Stockfish
- To play a game, you have to show Stockfish what the board looks like using the
position
command. This command uses two parameters: the notation you’re using and the current state of the board. Try typingposition startpos move e2e4
to do the King’s Pawn Opening as white.
Note: be sure to have a notepad app ready and use it to paste your moves.
- After pressing Enter, you might notice that nothing seems to have happened. But don’t panic – Stockfish has the move saved in memory. You just have to type
d
to show what the board looks like now.
- Now we’re going to make Stockfish think. Type
go movetime 1000
below the line that says “Checkers” to make it think for one second. The number is in milliseconds, and you can change that to make Stockfish stop thinking for a shorter or longer time.
- Stockfish will show you a ton of output, but the important part is the last line. The result may vary depending on the computer, but you should get something like
bestmove c7c5 ponder g1f3
in the end. This means that it currently thinks thatc7c6
is the best reply toe2e4
and that it expects you to playg1f3
after that.
- It’s time to make Stockfish move. Add the bestmove’s value after the original startpos command, then paste the value. In this case, we’re going to type
position startpos move e2e4 c7c6
in the terminal.
- At this point, it’s your turn again, so you should add your next move after
c7c6
. You can enterd
to see the board at anytime.
- Keep going until Stockfish (most likely) beats you.
Tip: Linux gamers should read on to learn about the best Linux distros for gaming[11].
Frequently Asked Questions
What is a chess GUI?
A chess GUI is like a virtual chess board – it lets you play chess on it without having to play with a physical chess board. They work with a protocol standard called UCI (Universal Chess Interface) to talk with chess engines so you could play games against them. Some can also let you make engines play against each other, just to see which one would win.
What is Universal Chess Interface?
Universal Chess Interface (UCI) is a set of protocols that tell how a chess engine should provide its outputs and ask for inputs. This lets you pit computer chess engines against each other, and help with making these very engines compatible with almost any kind of chess GUI in existence.
Is Stockfish open source?
In what language is Stockfish coded in?
Stockfish is mainly coded in C++. If you want to beef up your programming talent, try these coding games[12].
Image credit: Unsplash[13]. All screencaps by Terenz Jomar Dela Cruz.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
References
- ^ online board games you can play with your friends (www.maketecheasier.com)
- ^ among the strongest ones in the world (computerchess.org.uk)
- ^ Dragon (komodochess.com)
- ^ Windows Command Prompt (www.maketecheasier.com)
- ^ Linux Terminal (www.maketecheasier.com)
- ^ Wikimedia Commons (en.wikipedia.org)
- ^ AI Dungeon (www.maketecheasier.com)
- ^ Stockfish website (stockfishchess.org)
- ^ apt (www.maketecheasier.com)
- ^ Try GameMode. (www.maketecheasier.com)
- ^ the best Linux distros for gaming (www.maketecheasier.com)
- ^ coding games (www.maketecheasier.com)
- ^ Unsplash (unsplash.com)