Skip to content

Commit 8bd3113

Browse files
committed
-p for progress
1 parent 89f2702 commit 8bd3113

11 files changed

Lines changed: 399 additions & 411 deletions

File tree

doc/blackjack.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,17 @@ documentclass: report
3333
1. study
3434
2. change
3535
3. re-distribute
36+
37+
> This manual is like an implicit equation.
3638
3739
## Why
3840

3941
Since blackjack is not straightforward to analyze with analytical statistics equations, a monte-carlo-based approach is needed.
4042

43+
* compute evs and sds for different rules, decks and strategies
44+
* study arranged shoes
45+
* ...
46+
4147

4248
## How
4349

@@ -180,7 +186,7 @@ In the most basic case, an automated player reads messages from the dealer from
180186
These messages have to answered by the user.
181187
If an invalid answer is received, an informative message (@sec:informative) with a complain will be sent and then the same interrogative message will be re-sent.
182188

183-
```include
189+
```{.include shift-heading-level-by=3}
184190
commands-int.md
185191
```
186192

@@ -189,7 +195,7 @@ commands-int.md
189195
For basic players, all of the informative messages listed in this section can be ignored.
190196
For advanced players, almost all of the messages can be ignored.
191197

192-
```include
198+
```{.include shift-heading-level-by=3}
193199
commands-inf.md
194200
```
195201

@@ -257,7 +263,7 @@ decks = 1 # number of decks, negative means infinite
257263

258264
## Reference
259265

260-
```include
266+
```{.include shift-heading-level-by=2}
261267
conf.md
262268
```
263269

doc/commands-inf.md

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,46 @@
11

2-
* `shuffling` (@sec:shuffling)
3-
* `new_hand` (@sec:new_hand)
4-
* `bet_negative` (@sec:bet_negative)
52
* `bet_maximum` (@sec:bet_maximum)
3+
* `bet_negative` (@sec:bet_negative)
64
* `bet_zero` (@sec:bet_zero)
7-
* `card_player` (@sec:card_player)
8-
* `card_dealer_up` (@sec:card_dealer_up)
95
* `card_dealer` (@sec:card_dealer)
106
* `card_dealer_hole` (@sec:card_dealer_hole)
7+
* `card_dealer_up` (@sec:card_dealer_up)
8+
* `card_player` (@sec:card_player)
119
* `dealer_blackjack` (@sec:dealer_blackjack)
12-
* `player_wins_insurance` (@sec:player_wins_insurance)
10+
* `new_hand` (@sec:new_hand)
1311
* `player_blackjack_also` (@sec:player_blackjack_also)
12+
* `player_double_invalid` (@sec:player_double_invalid)
1413
* `player_split_invalid` (@sec:player_split_invalid)
1514
* `player_split_ok` (@sec:player_split_ok)
16-
* `player_double_invalid` (@sec:player_double_invalid)
15+
* `player_wins_insurance` (@sec:player_wins_insurance)
16+
* `shuffling` (@sec:shuffling)
1717

1818

19-
#### `shuffling` {#sec:shuffling}
19+
# `bet_maximum` {#sec:bet_maximum}
2020

21-
The dealer informs that he is shuffling the decks.
22-
This only happens when a non-zero value for the option `decks` is set.
23-
If `decks = 0` (or the command-line option `-d0` is passed), then cards
24-
are drawn randomnly from an infinite set of cards and there is no need to shuffle.
21+
The dealer complains that the bet the placer placed is invalid.
22+
The bet is larger than the maximum wager allowed by `maximum_bet`.
23+
The player will receive a new `bet?` message.
2524

2625
**Examples**
2726

2827
~~~
29-
shuffling
28+
bet_maximum
3029
~~~
3130

32-
#### `new_hand` $n$ $b$ {#sec:new_hand}
31+
# `bet_negative` {#sec:bet_negative}
3332

34-
The dealer states that a new hand is starting. The integer $n$ gives
35-
the number of the hand that is about to start (first hand is $n=1$).
36-
The decimal number $b$ states the player's bankroll before placing
37-
the bet in the hand that is about to start.
38-
Even though bets have to be integers, pay offs might be non-integer
39-
such as when winning a natural (e.g. $3/2 = 1.5$ or $6/5$ = 1.2).
33+
The dealer complains that the bet the placer placed is invalid.
34+
Only positive integer numbers are allowed.
35+
The player will receive a new `bet?` message.
4036

4137
**Examples**
4238

4339
~~~
44-
new_hand 1 0
45-
new_hand 22 -8
46-
new_hand 24998 -7609.5
40+
bet_negative
4741
~~~
4842

49-
#### `bet_negative` {#sec:bet_negative}
43+
# `bet_zero` {#sec:bet_zero}
5044

5145
The dealer complains that the bet the placer placed is invalid.
5246
Only positive integer numbers are allowed.
@@ -55,34 +49,61 @@ The player will receive a new `bet?` message.
5549
**Examples**
5650

5751
~~~
58-
bet_negative
52+
bet_zero
5953
~~~
6054

61-
#### `bet_maximum` {#sec:bet_maximum}
55+
# `card_dealer` $rs$ {#sec:card_dealer}
6256

63-
The dealer complains that the bet the placer placed is invalid.
64-
The bet is larger than the maximum wager allowed by `maximum_bet`.
65-
The player will receive a new `bet?` message.
57+
The dealer informs that the dealer has been dealt a card.
58+
The card is given as the two-character ASCII representation discussed
59+
in @sec:card_player.
6660

6761
**Examples**
6862

6963
~~~
70-
bet_maximum
64+
card_dealer TH
65+
card_dealer JC
66+
card_dealer 5D
67+
card_dealer 5H
68+
card_dealer QH
7169
~~~
7270

73-
#### `bet_zero` {#sec:bet_zero}
71+
# `card_dealer_hole` $rs$ {#sec:card_dealer_hole}
7472

75-
The dealer complains that the bet the placer placed is invalid.
76-
Only positive integer numbers are allowed.
77-
The player will receive a new `bet?` message.
73+
The dealer informs what his hole card is.
74+
This message is issued only if playing the american rules, i.e.
75+
with `enhc = false` or `ahc = true`.
76+
The card is given as the two-character ASCII representation discussed
77+
in @sec:card_player.
7878

7979
**Examples**
8080

8181
~~~
82-
bet_zero
82+
card_dealer_hole KH
83+
card_dealer_hole AC
84+
card_dealer_hole 4H
85+
card_dealer_hole 5D
86+
card_dealer_hole 7H
87+
~~~
88+
89+
# `card_dealer_up` $rs$ {#sec:card_dealer_up}
90+
91+
The dealer informs that the dealer has been dealt the up card (i.e.
92+
the first card facing up). This message is issued only once per hand.
93+
The card is given as the two-character ASCII representation discussed
94+
in @sec:card_player.
95+
96+
**Examples**
97+
98+
~~~
99+
card_dealer_up KD
100+
card_dealer_up 7H
101+
card_dealer_up KH
102+
card_dealer_up QD
103+
card_dealer_up 6C
83104
~~~
84105

85-
#### `card_player` $rs$ {#sec:card_player}
106+
# `card_player` $rs$ {#sec:card_player}
86107

87108
The dealer informs that the player has been dealt a card.
88109
The card is given as a two-character ASCII representation where
@@ -123,88 +144,57 @@ card_player TD
123144
card_player 6H
124145
~~~
125146

126-
#### `card_dealer_up` $rs$ {#sec:card_dealer_up}
127-
128-
The dealer informs that the dealer has been dealt the up card (i.e.
129-
the first card facing up). This message is issued only once per hand.
130-
The card is given as the two-character ASCII representation discussed
131-
in @sec:card_player.
132-
133-
**Examples**
134-
135-
~~~
136-
card_dealer_up KD
137-
card_dealer_up 7H
138-
card_dealer_up KH
139-
card_dealer_up QD
140-
card_dealer_up 6C
141-
~~~
142-
143-
#### `card_dealer` $rs$ {#sec:card_dealer}
144-
145-
The dealer informs that the dealer has been dealt a card.
146-
The card is given as the two-character ASCII representation discussed
147-
in @sec:card_player.
148-
149-
**Examples**
147+
# `dealer_blackjack` {#sec:dealer_blackjack}
150148

151-
~~~
152-
card_dealer TH
153-
card_dealer JC
154-
card_dealer 5D
155-
card_dealer 5H
156-
card_dealer QH
157-
~~~
158-
159-
#### `card_dealer_hole` $rs$ {#sec:card_dealer_hole}
160-
161-
The dealer informs what his hole card is.
162-
This message is issued only if playing the american rules, i.e.
163-
with `enhc = false` or `ahc = true`.
164-
The card is given as the two-character ASCII representation discussed
165-
in @sec:card_player.
149+
The dealer informs that he has blackjack.
166150

167151
**Examples**
168152

169153
~~~
170-
card_dealer_hole KH
171-
card_dealer_hole AC
172-
card_dealer_hole 4H
173-
card_dealer_hole 5D
174-
card_dealer_hole 7H
154+
dealer_blackjack
175155
~~~
176156

177-
#### `dealer_blackjack` {#sec:dealer_blackjack}
157+
# `new_hand` $n$ $b$ {#sec:new_hand}
178158

179-
The dealer informs that he has blackjack.
159+
The dealer states that a new hand is starting. The integer $n$ gives
160+
the number of the hand that is about to start (first hand is $n=1$).
161+
The decimal number $b$ states the player's bankroll before placing
162+
the bet in the hand that is about to start.
163+
Even though bets have to be integers, pay offs might be non-integer
164+
such as when winning a natural (e.g. $3/2 = 1.5$ or $6/5$ = 1.2).
180165

181166
**Examples**
182167

183168
~~~
184-
dealer_blackjack
169+
new_hand 1 0
170+
new_hand 22 -8
171+
new_hand 24998 -7609.5
185172
~~~
186173

187-
#### `player_wins_insurance` {#sec:player_wins_insurance}
174+
# `player_blackjack_also` {#sec:player_blackjack_also}
188175

189-
The dealer informs that the user won the insurance.
176+
The dealer informs that both he and the user have blackjack.
190177

191178
**Examples**
192179

193180
~~~
194-
player_wins_insurance
181+
player_blackjack_also
195182
~~~
196183

197-
#### `player_blackjack_also` {#sec:player_blackjack_also}
184+
# `player_double_invalid` {#sec:player_double_invalid}
198185

199-
The dealer informs that both he and the user have blackjack.
186+
The dealer complains that the doubling-down request cannot be
187+
fulfilled. Doubling down is only possible when exactly two
188+
cards have been dealt in a hand and the `doa` or `da9` option is met.
189+
The player will receive a new `play?` message.
200190

201191
**Examples**
202192

203193
~~~
204-
player_blackjack_also
194+
player_double_invalid
205195
~~~
206196

207-
#### `player_split_invalid` {#sec:player_split_invalid}
197+
# `player_split_invalid` {#sec:player_split_invalid}
208198

209199
The dealer complains that the split request cannot be
210200
fulfilled. Splitting is only possible when exactly two
@@ -217,7 +207,7 @@ The player will receive a new `play?` message.
217207
player_split_invalid
218208
~~~
219209

220-
#### `player_split_ok` $k$ {#sec:player_split_ok}
210+
# `player_split_ok` $k$ {#sec:player_split_ok}
221211

222212
The dealer informs that the split request was successfully be
223213
fulfilled. The integer $k$ indicates the id of the split hand (the
@@ -230,17 +220,27 @@ player_split_ok 2
230220
player_split_ok 3
231221
~~~
232222

233-
#### `player_double_invalid` {#sec:player_double_invalid}
223+
# `player_wins_insurance` {#sec:player_wins_insurance}
234224

235-
The dealer complains that the doubling-down request cannot be
236-
fulfilled. Doubling down is only possible when exactly two
237-
cards have been dealt in a hand and the `doa` or `da9` option is met.
238-
The player will receive a new `play?` message.
225+
The dealer informs that the user won the insurance.
239226

240227
**Examples**
241228

242229
~~~
243-
player_double_invalid
230+
player_wins_insurance
231+
~~~
232+
233+
# `shuffling` {#sec:shuffling}
234+
235+
The dealer informs that he is shuffling the decks.
236+
This only happens when a non-zero value for the option `decks` is set.
237+
If `decks = 0` (or the command-line option `-d0` is passed), then cards
238+
are drawn randomnly from an infinite set of cards and there is no need to shuffle.
239+
240+
**Examples**
241+
242+
~~~
243+
shuffling
244244
~~~
245245

246246

doc/commands-int.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* `play?` (@sec:play)
55

66

7-
#### `bet?` {#sec:bet}
7+
# `bet?` {#sec:bet}
88

99
The dealer asks the user the amount to wage in the hand that is about to start.
1010
The player should send a positive integer in response.
@@ -16,7 +16,7 @@ first hand has an id equal to one so $k>1$ when splitting).
1616
bet?
1717
~~~
1818

19-
#### `insurance?` {#sec:insurance}
19+
# `insurance?` {#sec:insurance}
2020

2121
The dealer asks the user if she wants to insure her hand when the dealer's
2222
upcards is an ace.
@@ -29,7 +29,7 @@ The player should answer either `yes` (or `y`) or `no` (or `n`).
2929
insurance?
3030
~~~
3131

32-
#### `play?` $p$ $d$ {#sec:play}
32+
# `play?` $p$ $d$ {#sec:play}
3333

3434
The dealer asks the user to play, i.e. to choose wether to
3535

0 commit comments

Comments
 (0)