ID:2250395
 
Problem description:
What's the easiest/most efficient way to get the opposite of a given direction?

My bit-manipulation is really rusty.

turn(dir, 180)
turn() is the workhorse for sure. The time to use bitflags is when you need to do something with cardinal-to-diagonal or diagonal-to-cardinal conversion, detection, or something along those lines. Or if for instance you have a turf that can't be entered from certain directions, that's a time for bitflags. Autojoining is also best handled with bitflags.
Oh wow, that's embarrassing. I've used Turn () literally a few lines above...

Cheers!