Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
Experiment.dart
Game.dart
README.md
Util.dart
tosser.dart
tosser.html

README.md

Simple coin tosser (Dart version)

Simulate the results of a coin toss experiment. If a coin lands heads you win a dollar, if it lands tails you lose a dollar.

Build and run using the Dart Editor.

And then open the file "tosser.html" in your web browser. Hit the "Run simulation" button with the default values.

This executes the program and yields something like the following chart, simulating 200 runs of 20 coin tosses. The chart shows the frequency of your net winnings after each run.

-13 
-12 *
-11 
-10 *******
-9  
-8  *******
-7  
-6  *****************
-5  
-4  *******************
-3  
-2  *************************
-1  
0   *********************************
1   
2   ******************************
3   
4   *****************************
5   
6   *******************
7   
8   ***********
9   
10  **
11  
12  
13  
Something went wrong with that request. Please try again.