I get the following info from user
-Grid size
-Number of steps
-Percent chance of walking up, down, left and right (totally 100%)
Need some help setting this up,
So first get the info from them, then I would do a for loop for total number of steps they gave me, generate random up,down,left,right.
When they hit a boundary, the walking stops.
This is the code I was given. How do i find the random number with percentage changes they gave?
Believe I am suppose to set 3 boundary meeting functions
r = random();
if(r < Left) {
x = x-1;
} else if(r <Left+Right) {
x = x+1;
} else if(r<Left+Right+Up) {
y = y+1;
} else {
y = y-1;
}
e/ He says to have 3 random walking boundry functions (they give us up,left, right percentage values, we assume its down if its not one of the three)
This post was edited by gramkracka22 on Nov 7 2013 11:24pm