|
Pieters bash scripts
Documentation for the bash scripts I have published
|
This script simulates the Monty Hall problem to help decide on a strategy. More...
Go to the source code of this file.
Functions | |
| swap ($arg1, $arg2) | |
| Swap your choice from the chosen one to the other unrevealed door. | |
Variables | |
| if(func_num_args() -lt 1) | else |
| $winsa = 0 | |
| Number of wins for player A. | |
| $winsb = 0 | |
| Number of wins for player B. | |
| $prizepos = 0 | |
| Position of the prize. | |
| $guess = 0 | |
| Original guess. | |
| $i = 1 | |
| Counter for the number of rounds already done. | |
| $rand [0] = 0 | |
| Counts how often the random number was 0. Used for statistics at the end of the script. | |
| $rand [1] = 0 | |
| Counts how often the random number was 1. Used for statistics at the end of the script. | |
| $rand [2] = 0 | |
| Counts how often the random number was 2. Used for statistics at the end of the script. | |
| $apercent = winsa*100/i | |
| Percentage of wins for player A. | |
| $bpercent = winsb*100/i | |
| Percentage of wins for player B. | |
This script simulates the Monty Hall problem to help decide on a strategy.
Author: Pieter van der Star (info@.nosp@m.piet.nosp@m.ervan.nosp@m.ders.nosp@m.tar.n.nosp@m.l) Modifications by: (unmodified)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Definition in file monty_hall.sh.
| swap | ( | $arg1, | |
| $arg2 ) |
Swap your choice from the chosen one to the other unrevealed door.
| $arg1 | Position of the prize. |
| $arg2 | Position of the choice. |
Definition at line 85 of file monty_hall.sh.
| $apercent = winsa*100/i |
Percentage of wins for player A.
Definition at line 156 of file monty_hall.sh.
| $bpercent = winsb*100/i |
Percentage of wins for player B.
Definition at line 158 of file monty_hall.sh.
| $guess = 0 |
Original guess.
Definition at line 112 of file monty_hall.sh.
| $i = 1 |
Counter for the number of rounds already done.
Definition at line 114 of file monty_hall.sh.
| $prizepos = 0 |
Position of the prize.
Definition at line 110 of file monty_hall.sh.
| $rand[0] = 0 |
Counts how often the random number was 0. Used for statistics at the end of the script.
Definition at line 116 of file monty_hall.sh.
| $rand[1] = 0 |
Counts how often the random number was 1. Used for statistics at the end of the script.
Definition at line 118 of file monty_hall.sh.
| $rand[2] = 0 |
Counts how often the random number was 2. Used for statistics at the end of the script.
Definition at line 120 of file monty_hall.sh.
| $winsa = 0 |
Number of wins for player A.
Definition at line 106 of file monty_hall.sh.
| $winsb = 0 |
Number of wins for player B.
Definition at line 108 of file monty_hall.sh.
| if (func_num_args() -lt 2) else |
Definition at line 72 of file monty_hall.sh.