The exercise you have just performed has taught you how we can generate the two random variables that are at the heart of problem of the gamblers ruin with absorbing boundary conditions. In the language of the exercise we have just performed these random variables are: a bernoulli random variable that tells us whether the walker arrives in the pub or at home and a discrete random variable that tells us how many steps the walker will take before arriving at either the pub or at home. For the 1D random walk that you will study further by doing the python exercises and by going through the relevant chapters of the notes the probability of taking a step forward does not depend on where you are. What you are thus asked to simulate is a situation that you simulated for the penultimate task of this exercise. The final task is still useful, however, as it has hopefully allowed you to think about how we might go about simulating more complicated Markov chains.
close