--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/28882b73-afdd-45db-9255-36873cd65998n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/3ecc5f45-5743-4735-99bc-9fd4a3634935n%40googlegroups.com.
After Set Pos or Scan, however, the chess library did not know that this command had already been sent. When the next action—such as pressing the lever—asked the retro engine to move, the library sends a second ucinewgame and isready. That duplicate sequence will disturb the MAME engine. The latest fix keeps the required eager ucinewgame, but also synchronizes the chess library’s internal state so it knows that the current game has already been announced. The following lever/Switch Sides action should now send only position and go, matching the V3 behavior more closely.
Essentially first summer of 2025 we had to send an extra ucinewgame to get mame engines to work with the new chess library, now a year later we have to try to avoid sending it after a Scan or Set Pos. Both these actions are limited to MAME engines only.
To view this discussion visit https://groups.google.com/d/msgid/picochess/6fad9671-78ed-4b4c-8d94-14d592293eddn%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/a4b9a4a9-b232-48b9-9980-ef0ecb9d9a3an%40googlegroups.com.
File:
engines/mame_emulation/plugins/chessengine/init.lua
Diff, changed around line 744
- elseif (last_move == prev_move) thenShort explanation:
After Set Pos, Picochess immediately sends the selected PGN position to the MAME engine. When Switch Sides is used before another move is made, python-chess sends the same position again before go.
The MAME Lua plugin did not recognize that the complete move-stack command was identical to the position it had already applied. It therefore replayed the final move from the PGN history, changed its internal side to move, and returned a move for the wrong colour.
The change treats an identical position startpos moves ... command as a no-op. MM V then keeps the correct position and successfully starts playing after Switch Sides.
game began from a custom position created by Scan. After several moves, Set Pos preserves both:
Python-chess therefore sends something like:
position fen <custom-mate-position> moves ... h7h8qBut [init.lua (line 593 on my machine)](/opt/picochess/engines/mame_emulation/plugins/chessengine/init.lua:593) currently handles any FEN command containing moves by converting it to:
position startpos moves ... h7h8qIt discards the custom starting FEN. The Lua adapter then tries to replay the mate sequence—including the promotion—from the normal starting position. That explains the bizarre result: pieces returning to start position, pawns disappearing, and an unexpected queen appearing on h8.
At the moment LUA supports the 2 first cases:
-- Johan
Am 19.08.2026 um 11:28 schrieb Johan Sjöblom <messi...@gmail.com>:
The practical and easy way out would be to:
--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/72af96c1-548c-4140-8ddd-41d2046d8478n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/de6e1984-3dc4-4b18-b6e3-4d4c230556f6n%40googlegroups.com.
Scan the original problem position.
Play your four moves, or whatever...
Choose Save Game.
Select move two and use Set Pos with MAME.
Load the previously saved game.
To view this discussion visit https://groups.google.com/d/msgid/picochess/da1637ac-ef2d-4f66-82c3-308b500dd5aan%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/a8bc4fd5-ce03-4377-9fac-b58ebb8c3dcdn%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/72c099f9-fceb-46e6-9016-ebcdc0dd8bf9n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/0e345893-2542-411b-bd69-aa573b8b9accn%40googlegroups.com.
Good point Dirk.
And yes, the above Lua fix takes this into account and supports both valid UCI forms:The new chess library does not switch to FEN because the move list becomes long. It uses startpos when the recorded game starts from the standard position and fen when the recorded game has another starting position.
I also tested it on my Pi 4 now and it works... But I dont get an initial "Set Pieces" message as I intended when you ask for Set Pos. Its very important however to wait for the "OK" before starting to play. It takes a few seconds to set up a retro engine.
To view this discussion visit https://groups.google.com/d/msgid/picochess/183b77e4-2890-4896-b8c3-490cb66972a5n%40googlegroups.com.
Am 21.08.2026 um 16:58 schrieb Randy Reade <randy...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/CAE5Wduucttd5Ev1sii_d0pkQ_ggs0tNoZ2s3JYyG-kwPx9ZhUA%40mail.gmail.com.


Am 23.08.2026 um 10:24 schrieb Johan Sjöblom <messi...@gmail.com>:
This new Lua (also the previous Lua fix) actually makes the graceful recovery of an engine work better. In one of my tests the mm engine stalled and despite having time set to just some seconds it was thinking for more than 30 seconds. Maybe it would have responded eventually, but I tried to force a move, and the mm engine crashed. However, the graceful recovery worked exactly as planned and restarted the engine for me. And now because the engine was able to receive the starting position plus my existing move stack I was able to continue the game just by clicking the switch-sides... Nothing was lost.
--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/6ec5d0c1-865c-482f-be79-c3c827e8ce3cn%40googlegroups.com.
The important interface functions are:
Therefore the theoretical capabilities are:
- pos = interface.set_pos exists
- edit = interface.edit_game exists
- info = interface.show_info or interface.show_pv_after_move exists
The specification is still the same: With retro/MAME artwork active (rdisplay = True), lift any piece and replace it on its original square to switch between windows.
- X11: xdotool to send Alt+Tab
- Wayland: ydotool or swaymsg, selected through window-control-backend
- window-control-backend = none: disables runtime switching