Monte Carlo simulation of a biased random walk near a cliff edge.
This project simulates a stochastic process:
A drunk man performs a random walk along a line and may fall off a cliff.
The simulation estimates the probability of survival over multiple trials.
The system is modeled as a 1D random walk with an absorbing boundary.
- Initial position: 2
- Position 0 represents the cliff (fall)
At each step:
- Move toward the cliff (-1) with probability 1/3
- Move away from the cliff (+1) with probability 2/3
A simulation run ends when:
- The man reaches position 0 → fall
- The number of steps reaches 1000 → treated as survival
- Runs: 10000
- Probability toward cliff: 1/3
- Initial position: 2
- Max steps: 1000
The program prints:
- Survival ratio (approximate)
- Rational approximation of survival probability
Example:
experimental result: saves ratio = 0.73 ratio = 73/100
Because the walk is biased away from the cliff, the probability of survival is greater than zero.
This differs from symmetric random walk where eventual fall probability is 1.
python main.py
Igor Nikitin