interfacing an emulator
I was curious what the elo rating of UltraChess is.
UltraChess is a chess program running on old 8-bit Z80 based MSX hardware.
UltraChess requires someone to enter the moves manually on the keyboard of the MSX. It will then display the result on the screen. It has (had) no way of interfacing to an other chess program.
Enter OpenMSX. OpenMSX is an MSX emulator.
OpenMSX has a scripting interface. Using TCL scripts you can press keys on the virtual keyboard, switch the device on and off, peak in the memory, and so on.
The scripting of OpenMSX allowed me to create a Python script that starts a chess game on the emulated MSX and let it talk to an other chess program (if it can talk UCI). The result is a PGN-file that then can be processed using Bayes-Elo to calculate the ELO ratings.
The script is on GitHub.
You may whish to make a couple of changes before running it:
- uci_program should point to the (UCI) chess program you want it battle against
- pgn_file is the pgn-file where the results are written to
- msx_color can be either 'W' or 'B' and sets with what color the MSX plays, set to None to pick a random color
- search_time how long the UCI program and the virtual MSX think for each move, in milliseconds
- opening_book points to a PolyGlot openingbook, set to None to disable
This is an example of UltraChess playing against an other program (Shallow-blue in this case). On lichess.org you can read an analysis of it. Below you can view the game.
I don't know...yet!
The problem is that UltraChess is apparently so weak that it only loses from all the (UCI) chess programs I let it play against. To be able to calculate the elo rating, it should at least occasionally win or at least play draw.
Other projects: here and here.