variables needed: drunkard position roll average home count pub count roll count loop 2 to 7 (starting points) set home and pub count to 0 set roll average to 0 loop 500 tests per starting point set roll count to 0 set drunkard position to current starting point loop until drunkard reaches either home or pub, or some max iteration count generate a random number if random < 2/3 then drunkard heads towards pub (pos = pos - 1) else drunkard heads towards home (pos = pos + 1) end if increment number of rolls for this test if drunkard is at pos 8 then drunkard is home (increment home count for this starting point) exit test else if drunkard is at pos 1 then drunkard at pub (increment pub count for this starting point) exit test end if end loop calculate average rolls end loop display statistics for this starting point end loop Sample Output: Drunkard's Walk Start Pos Avg Blocks % Pub % Home 2 2.5080 99.6 0.4 3 5.8460 95.8 4.2 4 7.9420 94.6 5.4 5 9.7700 88.6 11.4 6 9.9580 79.8 20.2 7 7.7520 52.4 47.6 Drunkard's Walk Start Pos Avg Blocks % Pub % Home 2 2.9060 99.4 0.6 3 5.8100 96.2 3.8 4 8.5660 95.0 5.0 5 9.5460 86.6 13.4 6 9.4540 75.4 24.6 7 7.6100 51.8 48.2 Drunkard's Walk Start Pos Avg Blocks % Pub % Home 2 2.9180 99.0 1.0 3 5.3200 98.0 2.0 4 7.5460 93.8 6.2 5 9.5020 88.2 11.8 6 9.9700 77.4 22.6 7 7.8580 50.6 49.4 Drunkard's Walk Start Pos Avg Blocks % Pub % Home 2 2.7860 99.8 0.2 3 5.5060 96.2 3.8 4 7.6760 93.6 6.4 5 9.4520 87.6 12.4 6 9.4660 75.0 25.0 7 8.0720 50.8 49.2