Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+17 votes

I am confusing when do we subtract or add one to the position?

asked in CSC211_Winter2018 by (1 point)

2 Answers

+11 votes

I'm not sure exactly what you are asking but, I think the answer is randomly. You have to generate -1 or 1 randomly each time and then add that to the position.

answered by (1 point)
+5 votes

I understand the routine assignment is already due, but what may help for future reference is you can do a conditional statement where if your random number is 0 the position is "position++" and your else would be "position--"

answered by (1 point)
...