IWA-HWG Perl Course. Week 2 Project

Snake Eyes and Box Cars

This program has nested loops with an until loop inside a for loop.

This program has an until loop that counts the number of simulated rolls of two dice required to roll either "snake eyes" (two ones) or "box cars" (two sixes). This is considered one trial.

The outer loop is a for loop that performs the required sums over trials of the above scenario allowing the program to calculate the average number of rolls in a trial as well as the corresponding standard deviation.

The user inputs the number of trials. If the user does not enter a number greater than or equal to 1, he or she is given a second chance. If on the second chance, the user does not enter an appropriate value, a default value of 1000 trials is used.


snake_eyes.plx

Sample Output:
snake eyes output