CM151: Lab 8 -- Design and Random Processes.


Assignment

  • Write a program that performs a simulation to estimate the probability of rolling five-of-a-kind in a single roll of five six-sided dice
  • A random walk is a particular kind of probabilistic simulation that models certain statistical systems such as the Brownian motion of molecules. You can think of a one-dimensional random walk in terms of coin flipping. Suppose you are standing on a very long straight sidewalk that extends both in front of and behind you. You flip a coin. If it comes up heads, you take a step forward; tails means to take a step backwards.

    Suppose you take a random walk of n steps. On average, how many steps away from the starting point will you end up? Write a program to help you investigate this question.
  • Optional (nothing to turn in). Instead of a 1-D random walk, code up a random walk in 2 dimentions. Begin the agent in the center of the screen, represented by a small circle. On every time step, the agent will randomly move in one of the 4 dimentions. Every time the agent takes a step, update the circle's position. This should make for a pretty interesting animation!

Submission

Once you have finished your programs submit them to the course's Moodle site.