By Lee Spector, with help from Edward Pantridge, 2019

This page allows you to test, demonstrate, and experiment with Parrondo's paradox
as explained in "Losing strategies can win by Parrondo's paradox" by Gregory P. Harmer
and Derek Abbot, in *Nature*, Vol. 402, 23/30 December, 1999.

This is probably not completely self-explanatory; if you really want to understand
what's going on then please read the *Nature* article and/or Parrondo's brief description
of the games.

The simulator runs a specified number of trials and reports the average of the results from all of the trials. A single trial consists of a specified number of games played in succession. The number of games per trial and the total number of trials are parameters that can be changed below. For each game the user can play either game "A" or game "B". The allowed policies for choosing which game to play are:

- random choice for each game
- alternation of A, then B, then A, etc.
- alternation with some number of repeats; for example A, A, B, B, A, A, B, B, etc.
- play only game B (not discussed in the background articles, but may be interesting)

The policy is specified via the "Period" parameter below; a value of 0 specifies random choices, a value of 1 specifies alternation, and a value of some integer greater than 1 indicates alternation with that number of repeats (for example, use 2 to get A, A, B, B, A, A, B, B, etc.). A negative value (for example -1) specifies that only game B will be played.

As specified in the *Nature* article game A involves a single coin (coin
#1) while game B involves two coins (coin #2 and coin #3). The probability of winning
for each coin is specified as some "Base" value minus a small "Epsilon"
value. The values for Epsilon and the three bases can be specified below. When game
B is played the choice between coins #2 and #3 is chosen as follows:

If the accumulated "capital" (winnings/losses) for the current trial is a multiple of the parameter M then coin #2 is played; otherwise coin #3 is played.

Parameter M can be specified below.

All of the default values specified below are those used in the *Nature*
article, with the exception of Total Trials. The article specifies 50,000 total but
because that introduces a possibly long delay, and because the results are almost
identical when much smaller values are used, a default of 1,000 has been specified
here.

The output of the simulator reports your average final capital. You start with zero capital, so if this is greater than zero then you have come out ahead on average. The output also reports the "flip load" per coin, averaged over all trials. This indicates the percentage of played games that were decided via flips of coins #1, #2, or #3.

Period:

Epsilon:

p1 Base:

p2 Base:

p3 Base:

M:

Initial Capital:

Games per Trial:

Total Trials: