Another thought I had was that unless you trigger the electrocution by where the player is on the Y grid, they could potentially walk diagonal lines to “cherry pick” coins. In a manner similar to the horizontal - vertical solution that just finds the MAX.
In other words if you use the lightning to prevent them from moving back as they move forward this should force them into choosing from the 2 coins.
Right now I can move up and down the left side without being electrocuted.
I just tried to walk a diagonal as well and got toasted. So it looks like trying to find the max and then selectively grabbing that coin isn’t possible anymore. At least not with the code I am trying. I sent you another message with the diagonal walking code.