|
|||||||||||||
|
Problem Set 5: Conditionals and Random Numbers Assigned: Wednesday February 18, 2009 Due: Tuesday February 24, 2009 Points: 5 This problem relates to the use of random numbers and conditionals in simulations. You should develop a simulation of the pegbox described in class and shown below.
The simulation should represent a ball as it falls to the bottom of a box. The box has regularly spaced pegs and, as the ball falls from top to bottom, it hits pegs which divert the path of the ball to the left or right with 50% probability. Your simulation should run again whenever the user manually recalcuates the spreadsheet (F9 on Windows, Cmd-= on a Mac). For a bonus point, create a bar graph where there is one bar for each possible ball position on the bottom. The height of the bar should be reflect the number of times that the ball landed in that position. |