The code for the simulation itself is very simple and mainly contained within two functions, that coordinates everything and that turns the player based on the current direction and random turn.
The function takes probabilities for turning left ( ), right ( ), or continuing straight ( ) and an argument for the number of steps in the simulation ( ).
The update tracker function is just a convenience function for adding rows to a data frame of the current state of the simulation at each step.
Therefore, I wrote the function to reduce any angle to lie within 0 and 2 (because we removed the constant $\pi$ from the angle of direction).
Since I allowed for a probability of going straight in the function, solving the extra credit problem requires no change to the code other than a single argument value.