Undo'ing a checkers move,Undoing a move

I’m currently making the undo button for a checkers game. If I move a piece, is there a generic method to just reverse the function that moved the piece or will I have to write one?

Just checking before I do so, all replies are appreciated,I’m currently making the undo button of a checkers game. If I click on a piece to move it from one place to another, is there a generic undo function that allows me to reverse the movement or will I have to write my own?

Just asking to check, thanks for any replies

You will have to write your own.

If you have a class representing a ‘move’ then store these in a stack since the last-in-first-out behaviour is exactly what you want for getting and setting undone moves.