Can the algo click the 'undo' button

What I’m trying to do is having my algorithm check that it’s not blocking off any of the edges when deploying new firewalls.
So I thought I could use the filter_blocked_locations function after deploying and make the algo push the ‘undo’ button if it does block something, but I can’t find a corresponding function in the reference material.
Does it exist at all / is there any other way to do that (ex: duplicate game state and apply changes to copy, then apply to state only if the changes are good) ?
Thanks in advance

No, there is not directly an undo button like in the playground (this is just to make it easier for humans to place stuff).
But there are other ways, for example making a copy of the game_map, placing the filter and then checking for blocked edges etc.
Or if it is already blocked, the attempt_remove function could help, eventhough this will take one turn time.