9 ms·
Stockfish – Strong Open-Source Chess Engine
- komaromy 10y agoNot just strong; it hasn't failed to place at least second in any TCEC season (the de facto computer chess world championship) since 2013 [0]. [0] https://en.wikipedia.org/wiki/Top_Chess_Engine_Championship#Tournament_results https://en.wikipedia.org/wiki/Top_Chess_Engine_Championship#...
- K_REY_C 10y agoThe stalemate game referenced in the article is amazing. I've never seen it before and it's incredible. http://www.chessgames.com/perl/chessgame?gid=1714659 http://www.chessgames.com/perl/chessgame?gid=1714659
- syshax 10y agoFor anyone else out there who may be a chess imbecile like myself... it took me a while to figure out why black king doesn't take white rook: It's because if they do, white has no legal moves, but king isn't in check. This condition, where a player can't move, but the king currently isn't in check, results in a stalemate (which is considered a draw). Therefore, white's baiting of black into that position by sacrificing pieces is interesting.
- cicero 10y agoThank you, I'm also a chess imbecile and was mystified.
- bfstein 10y agoI'm so confused by the endgame. Why did white move its queen to F4? How did the last sequence of moves end in a stalemate?
- prawn 10y ago(Have barely played chess since I was a kid, but guessing below until you get a better/accurate answer.) White was in trouble before throwing away the bishop as the black queen was in a deadly position, so it looked to get any free pieces it had blocked from moving as a viable strategy at aiming for a draw. As for the stalemate, I assume the 50-move rule, part (a)? It was either going to draw through losing the rook or via 50 moves without losing/taking a piece. "The game is drawn, upon a correct claim by the player having the move, if (a) he writes on his scoresheet, and declares to the arbiter his intention to make a move which shall result in the last 50 moves having been made by each player without the movement of any pawn and without the capture of any piece, or [snipped]" https://en.wikipedia.org/wiki/Fifty-move_rule https://en.wikipedia.org/wiki/Fifty-move_rule
- agarden 10y agoNo, three-fold repetition would happen long before fifty moves transpired. That's the normal conclusion of perpetual check. https://en.wikipedia.org/wiki/Perpetual_check https://en.wikipedia.org/wiki/Perpetual_check
- barrkel 10y agoThe White move to f4 put the Black king in check; if White hadn't put the Black king in check, Black would have checkmated with Queen to a1.
- dmurray 10y agoA stalemate [0] occurs when the side to move has no legal moves but is not in check. Note that a stalemate is a special case of a draw: every stalemate is a draw but not every draw is by stalemate. In the final position, if Black captures the rook, it is stalemate. If he does not, White will keep giving check on the seventh rank and the game will soon be a draw by repetition[1]. This game is particularly special because before 46. Bb3 White has six pieces, all of which have legal moves, making stalemate apparently unlikely and checkmate inevitable from Black's aggressively placed Queen and Knights. It's surprising to a human that within a few moves, White is able to force Black to capture or block all 6 of those pieces and give stalemate. There are famous combinations from human play where one side manages to sacrifice "desperado" pieces for stalemate [2][3], but nothing so ingenious as this one. Specifically, Queen to f4 forces Black to both capture the Queen and block the pawn on f3. [0]https://en.m.wikipedia.org/wiki/Stalemate https://en.m.wikipedia.org/wiki/Stalemate [1]https://en.m.wikipedia.org/wiki/Threefold_repetition https://en.m.wikipedia.org/wiki/Threefold_repetition [2]http://www.chessgames.com/perl/chessgame?gid=1252040 http://www.chessgames.com/perl/chessgame?gid=1252040 a famous example [3]https://chess-db.com/public/game.jsp?id=4500512.14117908.50842880.28874 https://chess-db.com/public/game.jsp?id=4500512.14117908.508... a less well known example I witnessed in person. An amateur woman shocks a top grandmaster.
- mrcactu5 10y agois this an effective tool for beginners?
- TylerE 10y agoDepends on what you want?' To play against...no. It will crush you like a cockroachh. it will crush a grandmaster like a cockroach....running on a smartphone.
- avarsh 10y agoYou can set the skill level. As a complete chess novice, I can do okay at very low difficulty. A level or two above the minimum and it completely wrecks me though. For anyone interested in playing with it yourself, you can use python-chess (https://pypi.python.org/pypi/python-chess https://pypi.python.org/pypi/python-chess) to set up / play against the engine (or make engines play against each other) without having to directly use the UCI commands. edit: It looks like there are quite a few other front-ends that will work with Stockfish. Fritz and PyChess look popular. I just used python-chess for a project a while ago.
- maaaats 10y agoWith a lower skill level it plays weird, almost useless to learn from compared to playing other humans.
- edko 10y agoBrowsing the source code, I was not able to find an openings database. Is it so strong in openings theory that it is able to compute it on the fly?
- dsjoerg 10y agoYes
- joeyrobert 10y agoUCI chess engines typically defer opening book to the GUI consuming it. So if you were using Stockfish with Arena or Tarrasch, that would handle the opening book. Stockfish will start calculating when it is out of the book. This is all configurable, of course.
- posnet 10y agoWow, it's only 8000 lines of code.
- deleted 10y ago[deleted]
- dfan 10y agoPull requests are regularly rejected for increasing the size of the codebase, even if they slightly improve the strength of the engine. It's hard to argue with the results.
- xal 10y agoOne aspect of chess that's really interesting is UCI which stands for univeral chess interface. It's a simple protocol that all engines "speak" and almost all pieces of chess software support. Chess players tend to collect engines that are good at certain things and then use whatever UX they are most comfortable with. At least in the past before Stockfish became so dominant. The chess community in general is pretty technical. lichess.org is an absolute marvel of a website. It's full of brilliance and it's all open source. Interestingly it's computer analysis feature went through a notable progressions of approaches: First it was server sided stockfish. Later they compiled stockfish via emscripten to .js so that analysis could run locally. This recently became PNACL for speed and finally even more recently WebAssembly for portability. Pretty cutting edge for the community of such an old game!
- virtualwhys 10y agoInteresting, lichess server-side is written in Scala, but client is straight js/jquery. I'd think they'd switch to Scala.js at some point, but if it works as is maybe no need to change anything...
- dyeje 10y agoI'd be surprised if they did use Scala.js. It's not even at 1.0 yet and I imagine the ecosystem surrounding it is a tiny fraction of vanilla JS.
- virtualwhys 10y agoScala.js has been stable for quite some time (0.6 is effectively 1.0 but author has been holding off on giving the 1.0 blessing). Ecosystem is indeed tiny compared to vanilla JS, but aside from Typescript what alt-js project's ecosystem isn't miniscule? The value proposition of Scala.js, GHCJS, Bucklescript, etc. are static types, 2-way interop, and all the features of the host language representable in javascript (which is incredible). Lichess' approach works quite well, I have no issue with jQuery on the client while doing the heavy lifting on the server; not everything needs to be a 20MB SPA.
- 10y ago
- billforsternz 10y agoFor Windows computers Tarrasch Chess GUI http://www.triplehappy.com http://www.triplehappy.com is a very simple way to experiment with Stockfish (it's installed as the default engine). Disclosure: I am the author of the Tarrasch Chess GUI.
- glinscott 10y agoVery cool to see Stockfish up here :). One of the cool parts is that the testing framework is fully open as well, at http://tests.stockfishchess.org/tests http://tests.stockfishchess.org/tests. It's been pretty amazing to watch the progress of SF since it was put on github by Marco and Joona. http://spcc.beepworld.de/ http://spcc.beepworld.de/ has some nice graphs. Those graphs are in ELO scale as well, so a linear line is getting exponentially stronger. Currently for example, there 87 machines, contributing 341 cores of computing power for testing patches. That's pretty awesome for completely volunteer driven community!
- shpx 10y agoSomeone organized a tournament of iterated prisoner's dilemma with access to the opponent's source code. Can't seem to find examples of anyone trying this with chess on google. http://lesswrong.com/lw/hmx/prisoners_dilemma_with_visible_source_code/ http://lesswrong.com/lw/hmx/prisoners_dilemma_with_visible_s...
- Aron 10y agoSo how are all the magical constants optimized?
- lenocinor 10y agoI also want to know this.
- xoroshiro 10y agoMost ideas are tested by an awesome framework. The basic idea is people donate cpu time to test out different versions of stockfish. Truly in the spirit of open source! http://tests.stockfishchess.org/tests http://tests.stockfishchess.org/tests As for "magic numbers", parameters are done by automated tuning. Disclaimer: I'm not an expert at this. There are too many parameters to attempt to optimize everything globally, so it looks like only certain variables are selected (this probably requires lots of domain knowledge) and optimized at a time using something that resembles a gradient descent of sorts. You can read more about it here: https://chessprogramming.wikispaces.com/Stockfish%27s+Tuning+Method https://chessprogramming.wikispaces.com/Stockfish%27s+Tuning... There are also other tuning methods. notably, the one used by another chess engine, Texel. Which is also interesting and used by several strong engines. The chess programming wiki is a really good resource if you want to read more. Finally,I can't find it, but I've read that Stockfish is so strong, that Andscacs, another strong chess engine that participates in the TCEC, was tuned by minimizing the standard deviation of its evaluation function with that of Stockfish. That sort of blew my mind when I first read it.
- Aron 10y agoThanks for the links. Their optimization approach isn't particularly sophisticated. Not saying I know how to do better, but wouldn't be surprised if it existed.
- atemerev 10y agoWow, this is BY FAR the best C++ code I ever saw! It should be a study in itself.
- unicornporn 10y agoIf you're on an Android, here's a great open-source client: https://f-droid.org/repository/browse/?fdfilter=droidfish&fdid=org.petero.droidfish https://f-droid.org/repository/browse/?fdfilter=droidfish&fd... https://play.google.com/store/apps/details?id=org.petero.droidfish https://play.google.com/store/apps/details?id=org.petero.dro...
- 1ba9115454 10y agoChess can be life changing. To get to any decent level you have to think how your opponent will respond to your next move. I found myself applying this to day to day life situations.
- ch8230 10y agoHere's a very simple web client I wrote if you want to give Stockfish a whirl: https://chessui.com/ https://chessui.com/ Shameless plug I know but I'm posting it for those who want to give it a shot against stockfish.
- bambax 10y agoAccording to this page http://www.computerchess.org.uk/ccrl/404/ http://www.computerchess.org.uk/ccrl/404/ Stockfish has the highest ELO of all engines... but how can an open-source engine be best? How don't the other engines learn from it and become at least as good, if not better?
- nojvek 10y agoCould some one explain how stock fish does its magic? What are the underlying algos it's using to beat humans like a fly swat.