Object Library > Applets > Red Black Experiment
In the red and black experiment, a player starts with an initial fortune x and bets (at even stakes) on independent trials for which the probability of winning is p. Play continues until the player is either ruined or reaches a fixed target fortune a.
Either of two player strategies can be selected from a list box. With timid play, the player bets 1 on each trial. With bold play, the player bets her entire fortune or what is needed to reach the target (whichever is smaller). Variable J indicates the event that the player wins (reaches her target) and variable N is the number of trials played. These variables are recorded on each update. The first graph shows the initial and target fortunes and the final outcome. The density of J is shown in blue in the distribution graph and recorded in the distribution table. On each update, the empirical density of J is shown in red in the distribution graph and recorded in the distribution table. The mean of N is shown in blue in the last graph and is recorded in the last table. On each update, the empirical mean of N is shown in red in the last graph and recorded in the last table. The parameters x and p can be varied with scroll bars, and the target fortune a can be chosen from a list box.
This applet illustrates the topics and concepts in the list below. Click on the links to learn more about the mathematical theory.
Click on the link below to download the Java archive file:
To add the applet to your web page, insert the following in the html file, at the point where you want the applet to appear:
<applet code="edu.uah.math.experiments.RedBlackExperiment.class"
archive="RedBlackExperiment.jar" width="600" height="350"></applet>
The jar file and the html file must be in the same folder.
This width and height dimensions are simply suggestions and can be varied. Generally, components such as graphs and tables expand and contract proportionally, while components such as buttons, scrollbars, dice, and coins are fixed in size.
Copyright © 2001-2003 Kyle Siegrist, Dawn Duehring
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.
If you are interested in the Java source code or the Java documentation and object model for this applet, please visit RedBlackExperiment in the Object section of the Library.