You can simply check the rotation of a player, might be easier than checking it like that
myPlayer().getRotation()
If you enable myPlayer debug in the debug tab, it will be included.
If interacting with an entity these values sometimes shift a little bit.
0 = South
256 = South-West
512 = West
768 = North-West
1024 = North
1280 = North-East
1536 = East
1792 = South-East