I'd recommend using a while loop. In the case described in part (b), the structure of the code looks something like this. I'm going to write the code for the standard geometric distribution case, and I think you can extend to your case.
# returns the number of turns before selecting something with probability p
simulation <- function(p) {
number_of_turns <- 1
# exit the loop with probability p, which means
# stay in the loop with probability 1-p
while (runif(1) > p) {
# account for the turn and try again
number_of_turns <- number_of_turns + 1
}
number_of_turns
}