24

If you're trying to make the strongest engine possible, absolutely go for NN engines. Traditional engines are great - Stockfish is arguably still the strongest engine on the planet on consensus equal hardware - but they are hard to write. These engines didn't get where they were overnight; they took years and years of work. Stockfish for example has been ...


15

Using @Phonon's Python script, I was able to determine that the worst move is 1. g4?? from the BBQRNNKR starting configuration, or 1. b4?? from its mirror image. This evaluates to -2.5 in one second of Stockfish search. Not quite a minor piece, but still a substantial handicap to recover from. Why is this position so powerful for the opponent? The black ...


13

In the beginning years of computer chess, people have actually tried to teach computers chess in the same way as they do with humans, explaining strategic concepts like a healthy pawn structure or the initiative. These attempt were soon abandoned because the method you describe was much more successful. Recently, there has been another attempt to let an ...


12

Your "checkless" chess AI would run into problems with the stalemate rule. It would consider the poaition with white king on a6, white pawn a7, black king a8, a win for White because wherever Black moves his king it will get captured. In standard chess, of course, the position is a draw.


12

Threefold-repetition is about a position (not moves) occurring three times. Those positions do not have to be reached by the same moves. Also (as this also seems to be confused sometimes) it is completely irrelevant when this happens, e.g. you can have the same positions after moves 10, 42 and 63 and it would still be a draw. You should check whether the ...


12

A good chess engine won't stop after a predetermined number of moves, but will keep looking until the position is "quiescent", which roughly speaking means that there are no pending captures or checks. See Quiescence Search in chessprogramming wikispaces for a more detailed explanation.


11

Crafty Crafty is a strong chess programm and can be used with Winboard, Xboard and Scid. So it is available for all major operating systems. Scid Scid can maintain databases of chess games, you can analyse (end) games.The software is available for all major operating systems. Xboard Xboard is a user interface to the Internet Chess Server. It uses the X ...


11

Stockfish assumes that all FEN positions you feed it are legal positions. If you feed it an illegal position and ask it to evaluate it, it will likely crash: Stockfish 5 64 by Tord Romstad, Marco Costalba and Joona Kiiski position fen 4k3/4p3/8/8/8/8/8/3KP3 go depth 14 Segmentation fault: 11 But you could use a Python library such as Chessnut to validate ...


11

Let's use Stockfish to find out the moves for this position [fen "N7/P3pk1p/3p2p1/r4p2/8/4b2B/4P1KP/1R6 w - - 0 34"] The FEN string is: "N7/P3pk1p/3p2p1/r4p2/8/4b2B/4P1KP/1R6 w - - 0 34". You should copy-and-paste my commands to experience yourself. Load the position by "position fen ..." and then use "d" to print the position. Please note that "d" is a ...


10

PyChess Is a chess client built in Python. You can use it's chess logic libraries without much trouble. http://code.google.com/p/pychess/source/browse/utilities/arena.py http://code.google.com/p/pychess/source/browse/utilities/blunders.py Are examples of how you you might use the libraries to control chess engines, but you can also use just the chess ...


9

Stockfish Stockfish (website and github) is an open source and very strong UCI engine. As such it can do all you are asking for, but usually requires a GUI in order to do so. You can however access all functionality via a command prompt/shell as well.


9

There're only two protocols - UCI and Winboard. Winboard is an old protocol and not really being used nowadays. Crafty is the only major engine still supporting the Winboard protocol, but it's only because the engine is also very old. UCI is a newer protocol developed by Shredder, and is used everywhere - Windows, Macs, Linux, Android, iOS etc. UCI is really ...


9

Easy question. Announce your engine on the chess programming forum (http://talkchess.com/forum/index.php). There'll be engine testers adding your engine to their rating list, such as CCRL. But please and please provide a working compiled binary. Announce your engine, upload a compiled binary to somewhere like Dropbox. You'll hear feedback. EDIT cutechess ...


9

So, in terms of creating the strongest chess engine possible, should I go neural network or hard-coded? Don't choose a NN unless you have access to ridiculous(A few hundred Nvidia V100s). Training a NN to play chess takes so much hardware. See the people contributing to Lc0 to train over 200 million games. Since you will probably have trouble accessing the ...


8

Maybe you can take a look at TalkChess, a forum dedicated to computer chess. I found a recent thread that might be interesting for you: Progress in 30 years by four intervals of 7-8 years A couple of matches between (former) top engines are played on the same hardware. The test suggests that in the recent years (2002-2017), the gain is mainly made by ...


8

Computer detection of dead positions is much trickier than people think. It is unlikely that an algorithm exists that runs in reasonable time and is 100% accurate. It is easy to check for a simple condition like insufficient material (K+B v K, K+N v K). It is less easy to check for cases with blocked pawns, for instance: 2b1k3/8/8/1p1p1p1p/1P1P1P1P/8/8/...


8

First step: Define your goals/reasons I think this is the predominant factor. Which of these best fits you? (Choose only one) You want to enjoy a fun, challenging coding task You want to create an extremely good chess engine You want to learn about how chess engines work You want to learn/practice coding skills You want to learn/implement computer science ...


7

Would this be what you are looking for? PGN-extract (A command line utility) http://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/ I can see a flag in the feature doc that might help: -W[cm|epd|halg|lalg|elalg|san|uci] - specify the output format to use -Whalg is hyphenated long algebraic. -Wlalg is long algebraic -Welalg[PNBRQK] is enhanced long ...


7

The Chess Programming Wiki is a good place to start . As you will quickly find out, it's a rather large and complex problem space, with many challenges (conceptual as well as actual programming). There are plenty of open source engines out there which you could look at, to learn, or even to integrate into your engine. I think you'll generally find that ...


7

You said "blunder a piece" or "lose significant advantage", so how about mate since that is even worse? I could only find a few, but here they are. Since it takes at least two moves for there to be any interaction between pieces, I am going to start there, and use some logic, but I could still only find a very few. First, you have to keep in mind that ...


6

This is not a direct answer to your question — but because you're interested in Java, check out this link, which has a UCI compatible engine written in Java. Browsing through the code it looked quite readable. It loses to Crafty and Stockfish regularly, but that is to be expected — they usually looked ~4 ply deeper because of the speed difference. I think ...


6

If I were going to do this, I'd choose Stockfish, Fruit 2.1, and Crafty for no reason other than their high quality is proven. Then I'd compare and contrast the techniques, algorithms, and choices made by each. These aren't easy programs; it would be a lot of work to gain a true understanding.


6

Take a look at the C# port of Stockfish by bpfliegel. To my knowledge it is complete (was able to compile and run it) and even though it has not been updated in 11 months at the time of this post it is certainly much stronger than the other engines listed. When I tested its perft function it on my machine it was only a factor of 1.5 slower than the original ...


6

What you're looking for is a PGN file that contains several games. You can parse the game data and enter in the opening moves. A great resource is PGN Mentor where you can browse openings and download the appropriate PGNs.


6

It may depend a little on what your code can access, but either way you should read Ed Schröder's pages on this topic. Schröder was the author of the Rebel Chess software until his retirement about a decade ago. In the '90s Rebel was the strongest consumer/commercial chess software and the first such to beat a GM (Anand). Since retiring he turned Rebel ...


6

As others have said, UCI is the API you want. The full specifications of the protocol is here (the zip file extracts to a text file): http://download.shredderchess.com/div/uci.zip It's actually very straight forward and simple, a UCI engine must respond to and reply in plain text through stdin, stdout and stderr. In fact, you should be able to launch the ...


6

There is a detailed standard of PGN available, for instance here: PGN standard at the Wayback Machine. You will never see "e4 e6 f4" in a PGN file, since it is mandatory to mention the move number before white's move: "1.e4 e6 2.f4".


6

This is a very well known problem in chess programming. You should consider use the numbers generated by Pradyumna Kannan. Dr Kannan had kindly produced open-source the magic numbers. It is being used by Crafty and a few other chess engines including my own. You can read more by google "Crafty magic number". I've prepared a zipped file for you here. This ...


6

This variant is distinct from regular chess. Some positions you can win more quickly, and others more slowly. This comes about because stalemate is still a thing. [title "White to move. (a) mate in 3 moves (b) unroyal: capture king in 2 moves"] [fen "7k/5P2/8/5K2/8/8/8/8 w - - 0 1"] Solution: (a) 1. Kf6 Kh7 2. f8=R Kh6 3. Rh8# (b) 1. Kg6 Kg8,Kg7,Kh7 2. ...


Only top voted, non community-wiki answers of a minimum length are eligible