
(Hub engine) GUI for International Draughts
-
gwiesenekker
- Posts: 32
- Joined: Sun Feb 20, 2011 21:04
- Real name: Gijsbert Wiesenekker
(Hub engine) GUI for International Draughts
Hi,
I guess, like many of you, I regularly use AI while programming in “paste question into web browser and copy answer” mode. However, I noticed that the latest AI coding agents have become really good.
Yesterday I started from scratch with the latest ChatGPT Codex plugin for Visual Studio Code on Linux. I only provided the Draughts Utrecht font and Scan’s protocol.txt files in an otherwise empty directory, and then started building a GUI using Lazarus/Object Pascal, since it also supports Windows and macOS, by simply asking questions.
After one hour I had a GUI that could open a FEN file, generate legal moves — which worked right away for International Draughts — play moves, save and load the game as a PDN file, launch a hub engine, capture, edit and save the supported parameters, and drive the engine, all without writing a single line of code myself. It was hard to believe. It even showed things like “let me briefly launch a Python interpreter to simulate hub-engine output to verify that I am capturing it correctly” while generating, debugging, and verifying the code.
I will publish the project on my GitHub repo when it is finished.
Regards,
GW
I guess, like many of you, I regularly use AI while programming in “paste question into web browser and copy answer” mode. However, I noticed that the latest AI coding agents have become really good.
Yesterday I started from scratch with the latest ChatGPT Codex plugin for Visual Studio Code on Linux. I only provided the Draughts Utrecht font and Scan’s protocol.txt files in an otherwise empty directory, and then started building a GUI using Lazarus/Object Pascal, since it also supports Windows and macOS, by simply asking questions.
After one hour I had a GUI that could open a FEN file, generate legal moves — which worked right away for International Draughts — play moves, save and load the game as a PDN file, launch a hub engine, capture, edit and save the supported parameters, and drive the engine, all without writing a single line of code myself. It was hard to believe. It even showed things like “let me briefly launch a Python interpreter to simulate hub-engine output to verify that I am capturing it correctly” while generating, debugging, and verifying the code.
I will publish the project on my GitHub repo when it is finished.
Regards,
GW
-
Rein Halbersma
- Posts: 1727
- Joined: Wed Apr 14, 2004 16:04
- Contact:
Re: (Hub engine) GUI for International Draughts
That is really awesome. I have been having great experiences with AI tools too. E.g. I have an algorithm to index/de-index kings only endgames with symmetry equivalent positions removed. I just prompted regular ChatGPT and it wrote Python and C++ code! I was planning to try a Qt C++ GUI next, with the Kingsrow look and feel and the Hub protocol next.
-
gwiesenekker
- Posts: 32
- Joined: Sun Feb 20, 2011 21:04
- Real name: Gijsbert Wiesenekker
Re: (Hub engine) GUI for International Draughts
The GUI is almost done. Codex started to struggle a bit with tracking the actual engine state and the state the GUI thought it was in, but after suggesting 'we' should log the states and the state transitions and copying/pasting the log-output into the chat if an error occurred Codex quickly resolved all issues.
The GUI is almost done: the last played move is shown with a yellow outline, if there is only one legal move the move is shown in blue, if you click on a man/king and if it has only one move, the move is executed right away, otherwise the possible target squares are shown in green and you click on the target square to select the move. If the combination of source/target square is still ambiguous the target squares are shown in red and you should select the move from the move list.
You can play a game with a configured time-control and the clocks are shown. You can flip the board by hitting 'F'. Computer moves are annotated with depth, score and time-used. The state of the clocks is also recorded as annotation, so if you take back a move the clocks are also restored.
GW
The GUI is almost done: the last played move is shown with a yellow outline, if there is only one legal move the move is shown in blue, if you click on a man/king and if it has only one move, the move is executed right away, otherwise the possible target squares are shown in green and you click on the target square to select the move. If the combination of source/target square is still ambiguous the target squares are shown in red and you should select the move from the move list.
You can play a game with a configured time-control and the clocks are shown. You can flip the board by hitting 'F'. Computer moves are annotated with depth, score and time-used. The state of the clocks is also recorded as annotation, so if you take back a move the clocks are also restored.
GW
-
gwiesenekker
- Posts: 32
- Joined: Sun Feb 20, 2011 21:04
- Real name: Gijsbert Wiesenekker
Re: (Hub engine) GUI for International Draughts
BTW, I already verified the same Lazarus project compiles and runs on Windows. Perhaps it will also compile and run on Mac, but as I don't own a Mac I cannot check this myself (and I would have to port GWD to Mac also).
GW
GW
-
Rein Halbersma
- Posts: 1727
- Joined: Wed Apr 14, 2004 16:04
- Contact:
Re: (Hub engine) GUI for International Draughts
you can instruct the AI to put up a GitHub Actions workflow and test it on Mac/Linux/Windows after every code commit (in the cloud).gwiesenekker wrote: Fri May 22, 2026 23:40 BTW, I already verified the same Lazarus project compiles and runs on Windows. Perhaps it will also compile and run on Mac, but as I don't own a Mac I cannot check this myself (and I would have to port GWD to Mac also).
GW
-
Rein Halbersma
- Posts: 1727
- Joined: Wed Apr 14, 2004 16:04
- Contact:
Re: (Hub engine) GUI for International Draughts
so did it work and can you swap Hub engine or play a engine match between Scan & Moby Dam (or Kingsrow) e.g.?gwiesenekker wrote: Fri May 22, 2026 23:40 BTW, I already verified the same Lazarus project compiles and runs on Windows. Perhaps it will also compile and run on Mac, but as I don't own a Mac I cannot check this myself (and I would have to port GWD to Mac also).
GW
Re: (Hub engine) GUI for International Draughts
I also could not resist and now have a (paid) plus subscription for codex.
I now started a carrier project to see what it can do and can't, just to learn (and have fun).
Hope I have more information soon......
Bert
I now started a carrier project to see what it can do and can't, just to learn (and have fun).
Hope I have more information soon......
Bert
-
gwiesenekker
- Posts: 32
- Joined: Sun Feb 20, 2011 21:04
- Real name: Gijsbert Wiesenekker
Re: (Hub engine) GUI for International Draughts
I have published the latest version on Github in the repo https://github.com/gwiesenekker/GWDGUI. I have extended the hub-protocol for GWD as an engine: when you click MCTS GWD will show the results of 'guided' (not completely random) MCTS shoot-outs of the current position.
GW
GW
Last edited by gwiesenekker on Wed May 27, 2026 14:21, edited 1 time in total.
-
Krzysztof Grzelak
- Posts: 1398
- Joined: Thu Jun 20, 2013 17:16
- Real name: Krzysztof Grzelak
Re: (Hub engine) GUI for International Draughts
The website is not working.gwiesenekker wrote: Wed May 27, 2026 09:47 I have published the latest version on Github in the repo https://gwiesenekker.github.com/GWDGUI. I have extended the hub-protocol for GWD as an engine: when you click MCTS GWD will show the results of 'guided' (not completely random) MCTS shoot-outs of the current position.
GW
-
Joost Buijs
- Posts: 500
- Joined: Wed May 04, 2016 11:45
- Real name: Joost Buijs
Re: (Hub engine) GUI for International Draughts
Gijsbert means: https://github.com/gwiesenekker/GWDGUI
BTW, I sent you an email about the PC, one thing you could try.
-
gwiesenekker
- Posts: 32
- Joined: Sun Feb 20, 2011 21:04
- Real name: Gijsbert Wiesenekker
Re: (Hub engine) GUI for International Draughts
FYI, new version coming up that supports two engines.
Regards,
GW
Regards,
GW
Re: (Hub engine) GUI for International Draughts
The proof-of-concept I was working on, was an hardware emulator for the (old) Fidelity Dames Challenger (from around 1981). With only the ROM-code, and some insights in the memory-mapped IO, and basic knowledge what some Z80-routines were doing, I was able to create a program which worked without coding one line. It is indeed remarkable how things progress these days.
Bert
Bert
Re: (Hub engine) GUI for International Draughts
And here, the details from what we have done, summarized by codex.
For clarity below text is complete written by AI !!
Bert
Summary
We built a working MFC-based Dame Challenger emulator shell around the original ROM, with a visual board, seven-segment display, keypad/buttons, debugger support, sound, and a first bridge from the ROM’s internal board memory to the GUI board.
What We Implemented
We created the main emulator application around the Z80 ROM and memory map. The emulator loads dc.rom, executes it through the Z80 core, and exposes the machine state to the GUI through a snapshot model. The GUI reads that snapshot on a timer and redraws the display, board, status/debug text, and controls.
The LED display is driven from the ROM’s normal writes to the emulated hardware addresses. We mapped the ROM’s LED select/control behavior into four seven-segment digits, so the GUI display follows what the emulated machine is doing rather than using a separate fake display state.
We added input injection for the physical buttons and board squares. The square scan codes were updated from your measured values, so GUI square clicks now feed the ROM the same kind of row/column sensory-board values it expects.
We added the emulator beep by detecting entry into the ROM’s beep routine at 0x0199. Instead of replacing ROM behavior, the emulator simply observes that the ROM entered the sound routine and plays a short host beep.
We added search detection around the ROM search routine at 0x0F5B. While the ROM is inside search, board snapshot updates are suppressed so the GUI does not display temporary internal search positions.
We connected the internal ROM board state to the GUI board. The GUI board is updated when the ROM reads the sensory-board address 0x8000, because that read is naturally related to board/input processing. We also refresh when search exits.
Important Architecture Choices
The main principle was: let the ROM remain authoritative.
The emulator does not try to reimplement Dame Challenger game rules. The ROM still owns move legality, search, display output, button scanning, sound timing, and internal state. The GUI only visualizes and injects hardware-like inputs.
For board state, we chose to read the ROM’s internal board array from RAM at 0xA000. The important discovery was that the board is mirrored internally: GUI square 1 maps to internal index 0x36, and GUI square 50 maps to internal index 0x01. So we now use the ROM’s own external-to-internal conversion table instead of a guessed geometric formula.
We also discovered that internal board values were color-coded opposite from our first guess. Internal 0x04 represents a black man, not white. The piece decoder was corrected so GUI colors remain stable after the first board refresh.
To avoid showing invalid startup data, the board refresh refuses to replace the GUI board with an all-empty snapshot. This prevents early reads of 0x8000, before ROM board initialization is complete, from wiping the initial visible board.
For sound, we chose a non-invasive hook: detect ROM routine entry and play host audio. That keeps the ROM code path intact and avoids needing to emulate the original sound hardware perfectly at this stage.
For the GUI controls, we simplified the button panel and removed the unused J button. The remaining buttons map to the useful ROM inputs and piece-selection controls.
Current State
The project builds cleanly in Debug x64 with no warnings or errors. The emulator now has a faithful ROM-driven core, visible board/display state, hardware-style input injection, search-aware board updates, and basic beep support.
For clarity below text is complete written by AI !!
Bert
Summary
We built a working MFC-based Dame Challenger emulator shell around the original ROM, with a visual board, seven-segment display, keypad/buttons, debugger support, sound, and a first bridge from the ROM’s internal board memory to the GUI board.
What We Implemented
We created the main emulator application around the Z80 ROM and memory map. The emulator loads dc.rom, executes it through the Z80 core, and exposes the machine state to the GUI through a snapshot model. The GUI reads that snapshot on a timer and redraws the display, board, status/debug text, and controls.
The LED display is driven from the ROM’s normal writes to the emulated hardware addresses. We mapped the ROM’s LED select/control behavior into four seven-segment digits, so the GUI display follows what the emulated machine is doing rather than using a separate fake display state.
We added input injection for the physical buttons and board squares. The square scan codes were updated from your measured values, so GUI square clicks now feed the ROM the same kind of row/column sensory-board values it expects.
We added the emulator beep by detecting entry into the ROM’s beep routine at 0x0199. Instead of replacing ROM behavior, the emulator simply observes that the ROM entered the sound routine and plays a short host beep.
We added search detection around the ROM search routine at 0x0F5B. While the ROM is inside search, board snapshot updates are suppressed so the GUI does not display temporary internal search positions.
We connected the internal ROM board state to the GUI board. The GUI board is updated when the ROM reads the sensory-board address 0x8000, because that read is naturally related to board/input processing. We also refresh when search exits.
Important Architecture Choices
The main principle was: let the ROM remain authoritative.
The emulator does not try to reimplement Dame Challenger game rules. The ROM still owns move legality, search, display output, button scanning, sound timing, and internal state. The GUI only visualizes and injects hardware-like inputs.
For board state, we chose to read the ROM’s internal board array from RAM at 0xA000. The important discovery was that the board is mirrored internally: GUI square 1 maps to internal index 0x36, and GUI square 50 maps to internal index 0x01. So we now use the ROM’s own external-to-internal conversion table instead of a guessed geometric formula.
We also discovered that internal board values were color-coded opposite from our first guess. Internal 0x04 represents a black man, not white. The piece decoder was corrected so GUI colors remain stable after the first board refresh.
To avoid showing invalid startup data, the board refresh refuses to replace the GUI board with an all-empty snapshot. This prevents early reads of 0x8000, before ROM board initialization is complete, from wiping the initial visible board.
For sound, we chose a non-invasive hook: detect ROM routine entry and play host audio. That keeps the ROM code path intact and avoids needing to emulate the original sound hardware perfectly at this stage.
For the GUI controls, we simplified the button panel and removed the unused J button. The remaining buttons map to the useful ROM inputs and piece-selection controls.
Current State
The project builds cleanly in Debug x64 with no warnings or errors. The emulator now has a faithful ROM-driven core, visible board/display state, hardware-style input injection, search-aware board updates, and basic beep support.
