I made this topic public, because I post for every one to learn (including me.)
The last work I did on chess is at
If you haven't read that post, now is a good time to do so.
Especially the part about storing the game as a list of FEN (Forsythe Edwards Notation) board states in a CloudDB list.
The current board is always at the end of that list.
New move results are added to the end of the list.
To undo a move, copy the next to last item from the list and add it to the end of the list.
Then update the display from the new current board at the end of the list.
I don't remember having settled on a move notation for individual moves. There are a bunch of them.
I lost interest in this app 2 1/2 years ago.
P.S. Here is the abandoned incomplete next version of that app, in case there are parts you can use ...
chess_board_buttons_V1.aia (24.8 KB)