Here is a comprehensive breakdown of how to approach the code, the logic behind it, and the final implementation.

If facing East, it turns North, moves up, turns West, and prepares to move backward along the row. If facing West, it does the inverse.

for(int col = 0; col < size; col++)