You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/blackjack.md
+82-4Lines changed: 82 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,15 +86,93 @@ Proper quotation migh be needed if the value contains spaces. For example,
86
86
blackjack --internal --cards="TH JS 6D"
87
87
```
88
88
89
-
With no command-line options and no configuration file, `blackjack` starts in interactive mode and it is ready to start a blackjack game (see @sec:interactive for details).
89
+
With no command-line options and no configuration file, `blackjack` starts in interactive mode and it is ready to start an ASCII blackjack game (see @sec:interactive).
90
90
91
91
## Results {#sec:results}
92
92
93
-
TBD
93
+
Before exiting, the program prints a summary of the results in YAML format:
94
+
95
+
```terminal
96
+
---
97
+
result: "(-0.8 ± 0.3)"
98
+
rules: "ahc h17 das doa 3rsp 0decks"
99
+
mean: -0.008237
100
+
error: 0.00348378
101
+
hands: 1e+06
102
+
bankroll: -8237
103
+
busts_player: 0.139315
104
+
busts_dealer: 0.239251
105
+
wins: 0.447443
106
+
pushes: 0.086111
107
+
losses: 0.495896
108
+
total_money_waged: 1.13708e+06
109
+
blackjacks_player: 0.047392
110
+
blackjacks_dealer: 0.047318
111
+
variance: 1.34853
112
+
deviation: 1.16126
113
+
...
114
+
```
115
+
116
+
By default, the results are written in the standard error, as the standard output is typically used to send dealer's messages to the player.
117
+
Therefore, if you are not using stdout (e.g. because you used the internal player `-i`) and want to use the results with Unix pipes, you have to redirect the standard error to the standard output:
118
+
119
+
```terminal
120
+
$ blackjack -i 2>&1 | yq .
121
+
{
122
+
"result": "(-0.8 ± 0.3)",
123
+
"rules": "ahc h17 das doa 3rsp 0decks",
124
+
"mean": -0.007579,
125
+
"error": 0.00348416,
126
+
"hands": 1000000.0,
127
+
"bankroll": -7579,
128
+
"busts_player": 0.139308,
129
+
"busts_dealer": 0.239262,
130
+
"wins": 0.447834,
131
+
"pushes": 0.085761,
132
+
"losses": 0.495561,
133
+
"total_money_waged": 1136900.0,
134
+
"blackjacks_player": 0.047427,
135
+
"blackjacks_dealer": 0.047433,
136
+
"variance": 1.34882,
137
+
"deviation": 1.16139
138
+
}
139
+
```
94
140
95
-
In YAML
141
+
The YAML results can be written to a file by setting the variable `report` in the configuration file, where `stdout` is a valid file name.
142
+
So the redirection above can be also performed as
96
143
97
-
`yq`
144
+
```terminal
145
+
$ blackjack -i --report=stdout | yq .
146
+
{
147
+
"result": "(-0.9 ± 0.3)",
148
+
"rules": "ahc h17 das doa 3rsp 0decks",
149
+
"mean": -0.00889,
150
+
"error": 0.00348549,
151
+
"hands": 1000000.0,
152
+
"bankroll": -8890,
153
+
"busts_player": 0.139248,
154
+
"busts_dealer": 0.239346,
155
+
"wins": 0.447292,
156
+
"pushes": 0.085985,
157
+
"losses": 0.495988,
158
+
"total_money_waged": 1136880.0,
159
+
"blackjacks_player": 0.047253,
160
+
"blackjacks_dealer": 0.047674,
161
+
"variance": 1.34985,
162
+
"deviation": 1.16183
163
+
}
164
+
```
165
+
166
+
## Progress
167
+
168
+
If the number of played hands exceeds a couple dozen million, one might want to track the progress.
169
+
In that case, pass the option `-p` (or `--progress`) to get an ASCII progress bar in the standard error (remember standard output is used to play blackack).
Copy file name to clipboardExpand all lines: doc/help-options-base.txt
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,8 @@
2
2
-n<n> or --hands=n Specify the number of hands to play. Corresponds to the hands variable in the configuration file.
3
3
-d<n> or --decks=n Specify the number of decks to use in the shoe. Corresponds to the decks variable in the configuration file.
4
4
-f or --flatbet Do not ask for the amount to bet before starting a new hand and use a flat unit bet. Corresponds to the flat_bet variable in the configuration file.
5
-
-i or --internal -p or --progressUse the internal player to play against the dealer. See the manual for details and instructions to define the rules and optionally, the playing strategy and/or arranged shoes. Show a progress bar.
5
+
-i or --internal Use the internal player to play against the dealer. See the manual for details and instructions to define the rules and optionally, the playing strategy and/or arranged shoes.
6
+
-p or --progress Show a progress bar when playing a fixed number of hands.
6
7
-h or --help Print this informative help message into standard output and exit successfully.
7
8
-v or --version Print the version number and licensing information into standard output and then exit successfully.
8
9
--configuration_variable[=value]Any configuration variable from the configuration file can be set from the command line. For example, passing --no_insurance is like setting no_insurance = 1 in the configuration file. Command-line options override setting in the configuration file.
0 commit comments