i gota write this programme and i have no clue how to start or anythin.
... help me please anyone... thankz
In the random walk problem, a person is placed at the centre of an 11 metre long line. Each second, the person takes a 1 metre step either forward or backward at random.
Part 1
Write a program to determine how long the person will walk before reaching either end of the line. Have the program average 20 trials, and report the average and longest time. Use the non-Standard Random, with values <0.5 meaning to step forward and >=0.5 meaning to step backward.
Part 2
Patience, young warrior, you must finish your training first before taking on the enemy (ie: instructions to follow).
thankz lutz n lutz fo da help!!
Comments
:
:
: In the random walk problem, a person is placed at the centre of an 11 metre long line. Each second, the person takes a 1 metre step either forward or backward at random.
: Part 1
: Write a program to determine how long the person will walk before reaching either end of the line. Have the program average 20 trials, and report the average and longest time. Use the non-Standard Random, with values <0.5 meaning to step forward and >=0.5 meaning to step backward.
: Part 2
: Patience, young warrior, you must finish your training first before taking on the enemy (ie: instructions to follow).
:
:
: thankz lutz n lutz fo da help!!
:
The first thing you need to have is a way to store the position of the person. Then you can let him move along the line. I would suggest that you make that position relative to the beginning of the line for simplicity (i.e. he starts at 6).
Then you make a while-do loop, in which you let him make a step in either direction. This will repeat until he reaches either end. As you need to know the number of steps it took him, you'll also need to have a counter, which increases for each step.
To repeat this 20 times (or more), place the entire code in a for-do loop (including the placement in the middle of the line). The average and longest time are a simple matter of arithmatic and an if-then.
Now for the hard part: the non-Standard Random. I have no idea what your teacher meant by that. I only know the Randomize() and Random(). So you'll have to review your course-notes or course-books.