If you extract the Vector of the wall curve, direction it was created, then you should be able to find which walls were drawn in a clockwise direction and which are anit-clockwise.
This would be through comparing the angle between start and finish point of the curves to see if it was +/- of the x or y plane vector normal.
Then you can use the values as a conditional filter for your flipping.
I’m sure there is another way of doing this though
Edit: Check out this topic