Releases: thorsilver/SpaceDog
v0.97.7 -- Command line options + eval fixes
The fixes to 0.97.5.1 got us back on track (and to a 2216 on CCRL), so here we have some more tweaks, some for quality-of-life features and others for a slightly better evaluation function:
Command Line Options
When running SpaceDog, you can now use four different command line options rather than dealing with the main menu:
- -h [hash size in MB]: set the size of the hash file (in megabytes)
- -b [book name]: set the opening book to the given file and initialise it
- -s [path to Syzygy bases]: set the Syzygy tablebase path and initialise the tablebases
- -m [uci/xboard/console]: start SpaceDog directly in UCI, XBoard or console mode
So, for example, typing SpaceDog.exe -h 256 -b bookfish.bin -s syzygy -m uci will set the hash to 256MB, load the opening book 'bookfish.bin', initialise tablebases in the folder 'syzygy', and then jump straight into UCI mode. If you don't specify a mode, or start SpaceDog without any arguments, it will go to the main menu of previous releases with the default 64MB hash and opening book.
Note: If you only use the 'mode' command-line switch without the hash size option, UCI/XBoard mode will start without initialising the hash, so please do so with the appropriate UCI/XBoard/console commands (I added a new 'hash [size in MB]' command to console mode to allow this).
Evaluation Adjustments
Just two small changes here, but in a 25-game 40/4 match against 0.97.5.1, this version secured a 17-8 victory:
- Tapered evaluation: Added a game-phase calculation and a function to smooth the middlegame and endgame evaluations over the course of the game (to smooth over any eval discontinuities between game phases)
- Tempo adjustment: Again very minor, but added a slight bonus for the side to move
v0.97.5.1 -- Bugs Major and Minor
UPDATE: Fixed a bug with eval reporting to the GUI, executables below are fixed
Thanks to Tirsa@CCRL some bugs have become apparent -- my recent pruning additions created some very suicidal move choices. I've rolled those changes back to 0.97.4 standards, fixed several bugs pointed out by Tirsa, and fixed some other minor issues I'd been meaning to nail down for some time. SpaceDog now compiles with no warnings, and so far as I can tell it no longer randomly sacs the Queen in the position Tirsa sent over.
I'm going to be utterly squashed by work the next couple of weeks, so it's unlikely I'll fix the pruning issue within that time. As soon as I get some time I'll revisit this and will improve the search, hopefully without destroying anything this time.
SpaceDog is rated 2089 on CCRL right now -- let's see if I can improve this in the coming weeks/months.
v0.97.5 -- Late Move Pruning
First release of the weekend! This time I've added Late Move Pruning (LMP). As SpaceDog searches possible moves, it places them in a list in a sensible order to attempt to search better moves before worse ones. This means that moves later in the order are, generally speaking, less likely to produce great outcomes. LMP simply sets a threshold in the move order where moves beyond that point in the list are simply pruned (cut) from the search.
Implementing this has led to SpaceDog pruning about 30-40% of its generated moves, which is good, since that means she's wasting less time searching bad moves. Now this is sometimes a risky strategy, as great moves might still be lurking late in the order and only reveal themselves much further down the line, but those lines may never come to fruition anyway if the opponent plays unexpectedly. Again my testing is very early, but other chess engine authors have said their engines just straight jump 100+ Elo after adding LMR, so I'm confident it's a good choice!
Next up: Late Move Reductions (LMR), more search extensions for promising moves, maybe Static Exchange Evaluation??
Minor Update: I'd previously planned to add a fancy analysis mode to SpaceDog, but after playing with it for a while I realised it was a bit pointless. Realistically, most people would simply load SpaceDog into a chess GUI and use the GUI functions to analyse games with the engine, so having a special mode for console play only that takes loads of time to implement seems pretty silly. Instead I'm going to continue to work on the search, evaluation, and work toward faster move generation and multicore search further down the line :)
v0.97.4 -- Additional pruning
Added razoring and beta pruning early in the alpha-beta search. Testing is still ongoing, but so far SpaceDog can reach about 2 plies deeper in search at the 30 seconds per move level, pruning about 20 million nodes during that time. I call this a good start!
I'll keep working on SpaceDog's search efficiency to try and get deeper searches. This should lead to a substantial increase in strength if the evaluation is solid enough.
v0.97.3 -- Bugfix release
UPDATE: Windows build process now fixed using MinGW, Windows build no longer requires Cygwin to be installed, and is slightly faster :)
A little hotfix here for a bug that afflicted SpaceDog at times in console mode. Occasionally the human player could make an illegal move while in check, causing the engine to freak out and give that player an additional move, and other weird things.
I fixed this by checking whether the player's king is attacked twice before allowing a move to go to the board. This so far seems to catch the previous cases and prevent any oddities.
v0.97.2 -- New evaluation function
Just a quick update here -- I replaced evaluation.c with eval.c and eval.h, mainly to make the evaluation function cleaner. The piece-square tables are now in the header file, and the main evaluation function is rewritten with an evaluation vector composed of individual evaluations for each piece type, plus bonus for material score, knight/bishop/rook pairs, etc. The final score is then calculated by adding the components of the vector, and this value is then returned to the alpha-beta search function.
The main purpose of this is to A) improve code readability for myself, and B) prepare for future additions to the evaluation. Since I'm planning to work on analysis mode soon, I'd like to follow that up with a more robust eval at some stage. That being the case, I thought it was a good idea to clean things up a bit.
v0.97.1 -- Minor bugfix release
UPDATE Linux and Windows builds now available! Windows build requires access to cygwin1.dll, so please add that to your SpaceDog folder or make sure your machine has Cygwin installed. Note these are quick builds and may contain bugs not present in the MacOS release, which is where I'm doing most of my coding!
Minor bugfix release, and some adjustments to the TeX output functionality. For some reason I really enjoy being able to record my games with SpaceDog with nice diagrams, so I keep tweaking them to try and make them nicer.
At the moment there are two main TeX game recording functions: one produces a file with large diagrams, two per page, and includes a FEN string under each position to enable analysis in other programs. The other which I call a 'summary', although it isn't really, provides a complete PGN-format record of the game at the start, followed by small diagrams of every half-move with the current move highlighted for easy visibility.
To make use of these, at the start of your game in console mode, enter the command newtex to create a large-diagram game record, or startsum to start the summary format file. You can do both if you like, they're saved in separate files. Once the game reaches a conclusion, enter endtex to close the large-diagram record, or endsum to close the summary file. Once that's done the files can be quickly rendered using any LaTeX distribution that includes the packages skak, xskak, and chessboard.
For this release I slightly tweaked both files to remove some small errors in the output files, and changed the format in the large-format game records to use larger diagrams and SAN-format moves instead of long algebraic.
NB: These functions assume you won't be taking back moves, otherwise things will get weird :) I can probably address this shortcoming by using skak or xskak variations, so keep an eye out for that. Also I need to make some changes to the way checkmates, draws and stalemates are checked, as at the moment it's awkward to pass these results to the TeX records and sometimes the 50-move rule doesn't trigger correctly.
OK, that's it for now! MacOS binary available now, Windows/Linux coming later tonight, and two sample game records included for your enjoyment.
Next task on my list is analysis mode! This will include parsing PGN input files, eventually, and providing annotations. My goal is to connect analysis mode to the TeX output functions so SpaceDog's suggestions and corrections will be clearly diagrammed for the user.
Finishing up Syzygy tablebase integration
Following up on last week, now the Syzygy tablebases are fully integrated. First, you can now use the tablebases in console mode, Xboard mode and UCI mode:
- Console: command syzygypath PATH sets the path to your tablebase files, command usetb will turn on tablebase support and initialise them
- XBoard: command egtpath syzygy PATH will activate the tablebases and find them and initialise them at the given path
- UCI: command setoption name SyzygyPath value PATH will activate the tablebases and find them at the given path
If the path doesn't actually lead to the tablebases, and error will be returned and of course you can try again.
Second, SpaceDog now searches the WDL (Win-Draw-Loss) tables during search, and if it finds a pathway to a winning endgame, it will save the appropriate moves to its PV (principal variation). The number of hits in the tablebases are shown in the search as 'tbhits'. If you see SpaceDog's evaluation suddenly jump to 20,000, that means it found a path to a winning endgame; here's a sample of just such a search:
Material Total: 7
score:575 depth:1 nodes:20 tbhits: 0 time:9(ms) a4a3
score:645 depth:2 nodes:125 tbhits: 0 time:9(ms) g4c4 h5h6
score:680 depth:3 nodes:618 tbhits: 0 time:9(ms) g4c4 c5c6 c4c6
score:695 depth:4 nodes:2260 tbhits: 2 time:10(ms) g4c4 c5c6 g7f6 h5h6
score:710 depth:5 nodes:4567 tbhits: 14 time:12(ms) g4c4 c5c6 a4a3 e3d3 c4c6
score:760 depth:6 nodes:10051 tbhits: 42 time:16(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4
score:760 depth:7 nodes:18505 tbhits: 76 time:21(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:8 nodes:26627 tbhits: 132 time:25(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:9 nodes:41665 tbhits: 237 time:34(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:10 nodes:67655 tbhits: 417 time:49(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:11 nodes:102386 tbhits: 601 time:68(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:12 nodes:143165 tbhits: 800 time:92(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:13 nodes:195774 tbhits: 1026 time:119(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:14 nodes:288941 tbhits: 1507 time:165(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:15 nodes:475284 tbhits: 3076 time:261(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:16 nodes:845785 tbhits: 5647 time:443(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:17 nodes:1813092 tbhits: 16158 time:966(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:18 nodes:3033083 tbhits: 30362 time:1554(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:19 nodes:5883262 tbhits: 69594 time:3019(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:20 nodes:12830355 tbhits: 173443 time:6678(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 h6h5
score:20000 depth:21 nodes:45833626 tbhits: 516404 time:22528(ms) g4c4 c5c6 g7h6 e3d3 c4c6 d3e4 c6c4 e4d3 a4a3 d3e3 c4b4 e3f3 h6h5
In testing, this seems to work well and steers SpaceDog more toward moves that lead to winning endgames. Bear in mind I'm still working out some bugs, as always, and I'm not 100% sure the PV search is working perfectly at all times, but so far in practice things seem to be working!
So, go ahead and give it a try! With tablebases on board SpaceDog is a more fierce opponent.
v0.96.5
For details on endgame tablebases and how they've benefited SpaceDog, please see my verbose blog post here: https://drericsilverman.wordpress.com/2019/02/11/chess-engine-update-endgame-tablebases/
SpaceDog now has partial Syzygy tablebase integration! This is how you can get SpaceDog to play perfectly in all endgames with less than 7 pieces on the board:
- Download your Syzygy tablebase files and place them in a folder called syzygy in your SpaceDog folder
- Start SpaceDog, type dog to start console mode, then usetb -- this will automatically detect your tablebase files and set the appropriate options
- Once you hit a tablebase position, SpaceDog will play all of its moves out of the tablebase and choose the best available option to win, hold a draw, or prevent a loss as long as possible (depending on the WDL score of the position)
This took some fiddling to get working, particularly translating promotion moves into SpaceDog's format, but it all works now! Next step is to probe the WDL tables during search to help direct SpaceDog toward winning endgame positions. Also will add commands to use tablebases in XBoard and UCI mode, of course.
I've included the results (in snazzy PDF game records) of testing some endgames on the new TB-savvy SpaceDog -- specifically a KBNvsK endgame, where TB SpaceDog blazed toward an easy win that non-TB SpaceDog couldn't find at all, and a KPPvsKP endgame where TB SpaceDog won significantly faster, and with two promoted queens instead of one. These are also available in the repository. Enjoy!
UPDATE: Windows version now working! Download SpaceDog_TBs.exe and make sure you have Cygwin installed, then run from the command prompt or by double-clicking SpaceDog_TBs.exe in Windows Explorer.
UPDATED UPDATE: Linux version is now here too!
v0.96 - PGN Output and Game Summaries
Finally, success on the PGN front! After a really stupid amount of effort and fiddly tweaking to catch exceptions and clarify ambiguous moves, now SpaceDog can produce PGN files of your games! To turn this on, first you must be in console mode by entering the command dog -- since in UCI/Xboard mode you're using a GUI, which probably does this anyway -- and then you enter the command pgnlog to initialise the file. Play your game and once someone is mated or you can't take it anymore, just quit and your PGN will be ready for you!
Note it's not perfect yet -- draws aren't entered, and you'll have to clarify resignations, event dates, etc. in the file by yourself. But hey, it works! Mostly!
Not only that, I also used the LaTeX package xskak to create a template for a lovely game summary. This creates a TeX file with your complete PGN record inside, which when rendered will loop through the moves and output a diagram every 4 plies, including arrows and circles to show off the last move in the diagrammed position. Not to worry, the first and last moves are always shown. Sample screenshot:
How cool is that?!
Now, I think there's a bug lurking somewhere in this bit -- a recent game saw SpaceDog hang and produce a null move, which has never happened before. I worked hard to iron out bugs in the SAN move translation routines, and it shouldn't interfere with search or move generation at all, so I hope it was just a blip. Regardless, take care with this option until it gets finalised.
To generate a summary, enter startsum before your first move in console mode, then endsum at the end. Simple!
Final note: sample PGN, game summary TeX file and rendered PDF have been added to the repository as well.
