Nice! I like how you folded the absolute directions and the forward commands into one action with checks on the current direction. Look into the % (modulo) operator for handling the circular arithmetic around the rotation additions - in short (dir + num) % 360 for right turns and (dir + 360 - num) % 360 for left.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice! I like how you folded the absolute directions and the forward commands into one action with checks on the current direction. Look into the
%
(modulo) operator for handling the circular arithmetic around the rotation additions - in short(dir + num) % 360
for right turns and(dir + 360 - num) % 360
for left.