This website allows you to run probability experiments. You can flip coins, roll dice, and deal cards. You can specify various parameters, explained below.
The conditions for stopping an experiment or run of experiments and the counts that can be recorded use a particular syntax. Examples are given in the explanations below.
,,,,,.5
for a 6-sided die
assigns a probability of .5 to rolling a 6 with all other
numbers equally likely.
4♥
,
but when matching
use C
, D
, H
, S
for the suits.
The basic element is count(...)
which counts
the number of occurences of an event within an experiment.
For keeping track between experiments, there
is total(...)
.
These can also be used in the "recording" fields.
Logical and mathematical expressions using these can be
used.
count() = 10
Stop when the number of runs is
10.
count(h) = 10
Stop when the number of
heads is 10.
count(h) = 10 or count(t) = 10
Stop
when the number of heads is 10 or the number of tails is
10.
count(hht) = 3
Stop when the pattern
"HHT" has been seen three times.
count(hh,tt) = 1
When flipping two
coins, stop when two heads are followed by two tails.
count(hh) = 1 or count(th) = 1
Stop
when either HH or TH is seen.
count()
Count the number of flips.
count(h), count(t)
Count the heads and
the tails.
count(hh)/count(h)
Record the ratio of
"HH" to "H".
total(count() > 10) = 3
Stop when there
have been three experiments that have had at least 10
flips.
total(count(h) > count(t)) = 1
Stop
when an experiment has more heads than tails.
total(1) = 10
Stop after ten
experiments.
total(count())
Record the total number
of flips overall.
total(count(h))
Record the total number
of heads overall.
total(count(hh) > count(th))
Record the
total number of experiments where the number of HHs is
bigger than the number of THs.
Some notes on how the counts and totals are implemented:
HH
and the flips
recorded are HHH
then the pattern will
match twice.
count(h) >
3
). These are counted as 1 for true and 0 for
false.
So total(count(h) > 3)
counts how many
times the count of heads is bigger than 3.
The code is released under the MIT Licence so if you want to improve it, feel free. It is available on github.