Skip to content

Commit bf002ec

Browse files
committed
doc
1 parent b569856 commit bf002ec

6 files changed

Lines changed: 220 additions & 32 deletions

File tree

doc/blackjack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ The location of the configuration file can be given in the command line. If none
247247
> It is thus recommended to run each monte-carlo simulation that needs a particular configuration---and possibly other files such as card arrangements, strategies and/or results---in a different directory (a.k.a. folder) with a `blackjack.conf` file in it.
248248
249249
Individual variables can be set from the command line by passing one or more times
250-
the option `--configuration_variable[=value]` as explained in @sec-invocation.
250+
the option `--configuration_variable[=value]` as explained in @sec:invocation.
251251

252252
Comments can be inserted using either a hash `#` or a colon `;` at any position in the line.
253253
The following configuration file is the default provided in the main distribution tarball:

doc/commands-inf.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,15 @@ character $s$ gives the suit.
125125
| `J` | Jack |
126126
| `Q` | Queen |
127127
| `J` | King |
128+
: Rank (first) character of a card {#tbl:rank}
128129

129130
| Character | Suit |
130131
|:---------:|------------------|
131132
| `C` | ♣ Clubs |
132133
| `D` | ♦ Diamonds |
133134
| `H` | ♥ Hearts |
134135
| `S` | ♠ Spades |
136+
: Suit (second) character of a card {#tbl:suit}
135137

136138
The optional argument $h$ indicates the id of the player's hand
137139
being dealt. If it not present, that means the base hand.

doc/conf.md

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
* `blackjack_pays` (@sec:blackjack_pays)
3+
* `cards` (@sec:cards)
4+
* `cards_file` (@sec:cards_file)
35
* `dealer` (@sec:dealer)
46
* `decks` (@sec:decks)
57
* `flat_bet` (@sec:flat_bet)
@@ -13,6 +15,7 @@
1315
* `penetration_sigma` (@sec:penetration_sigma)
1416
* `player` (@sec:player)
1517
* `quit_when_arranged_cards_run_out` (@sec:quit_when_arranged_cards_run_out)
18+
* `rng_seed` (@sec:rng_seed)
1619
* `rules` (@sec:rules)
1720
* `shuffle_every_hand` (@sec:shuffle_every_hand)
1821

@@ -32,6 +35,57 @@ blackjack_pays = 1.5
3235
blackjack_pays = 1.2
3336
~~~
3437

38+
# `cards = ` $\text{list of cards}$ {#sec:cards}
39+
40+
If this option is given, the dealer draws the cards specified on the list.
41+
In the first hand, the order of the dealt cards
42+
43+
1. Player’s first card
44+
2. Dealer’s first card
45+
3. Player’s second card
46+
4. ...
47+
48+
where the ellipsis dots indicate continuation of the game (i.e. dealer's hole card for `ahc` or player’s hit card for `enhc).
49+
50+
These cards will be the ones specified on the list in the prescribed order.
51+
Each card is given by a two-character string, explained in @tbl:rank and @tbl:suit respectively.
52+
Cards should be separated by spaces.
53+
54+
The dealer will continue drawing from the list of arranged cards until either
55+
56+
a. there are no more cards in the list, in which case the dealer will continue drawing cards from either
57+
i. a shoe with the already-dealt cards removed, if `decks` is non-zero, or
58+
ii. a set of infinite cards , if `decks` is zero.
59+
b. the hand is over and `new_hand_reset_cards` is `true`, or
60+
c. `quit_when_arranged_cards_run_out` is true, in which case the program exits.
61+
62+
**Default**
63+
Empty list
64+
65+
**Examples**
66+
67+
~~~
68+
cards = TH JD 6C
69+
cards = 2S 5D QS AC
70+
cards = 8D QH TC 2C KD 7S 8S TD AH 5C
71+
~~~
72+
73+
# `cards_file = ` $\text{path to file}$ {#sec:cards_file}
74+
75+
This option is exactly the same as `cards` but the cards are given in a text file instead
76+
of directly in the configuration file.
77+
78+
**Default**
79+
No path
80+
81+
**Examples**
82+
83+
~~~
84+
cards_file = cards.txt
85+
cards_file = ../arranged_cards.txt
86+
cards = /var/games/cards.txt
87+
~~~
88+
3589
# `dealer = ` *game* {#sec:dealer}
3690

3791
Defines the game the dealer will deal.
@@ -157,8 +211,8 @@ If the actual dealt cards are not important but only reproducibility, it is easi
157211
**Examples**
158212

159213
~~~
160-
quit_when_arranged_cards_run_out = false
161-
quit_when_arranged_cards_run_out = true
214+
new_hand_reset_cards = false
215+
new_hand_reset_cards = true
162216
~~~
163217

164218
# `no_insurance = ` $b$ {#sec:no_insurance}
@@ -283,6 +337,25 @@ quit_when_arranged_cards_run_out = false
283337
quit_when_arranged_cards_run_out = true
284338
~~~
285339

340+
# `rng_seed = ` $n$ {#sec:rng_seed}
341+
342+
This option sets the seed of the random number generator used by the dealer to draw cards.
343+
This is used to get deterministic results. That is to say, the cards draw by two dealers using
344+
the same seed (and the same number of decks) will be the same.
345+
It is not possible to guess what the cards will be given a certain seed $n$.
346+
But the cards will be the same for two executions of the program with the same seed $n$.
347+
If this option is not set, the seed itself is as random as possible.
348+
349+
**Default**
350+
Entropic non-deterministic random seed from C++'s `std::random_device` (most likely `/dev/random`).
351+
352+
**Examples**
353+
354+
~~~
355+
rng_seed = 1
356+
rng_seed = 123456
357+
~~~
358+
286359
# `rules = [ ahc | enhc ] [ h17 | s17 ] [ das | ndas ] [ doa | do9 ]` {#sec:rules}
287360

288361
Defines the rules of the game.

doc/libreblackjack.texi

Lines changed: 119 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@documentencoding UTF-8
44

55
@setfilename blackjack.info
6-
@set UPDATED 2025-10-07
6+
@set UPDATED 2025-10-10
77
@set VERSION
88

99
@copying
@@ -31,7 +31,7 @@ Texts. A copy of the license is included in the section entitled
3131
@titlepage
3232
@title Libre@ Blackjack
3333
@author Jeremy Theler
34-
2025-10-07
34+
2025-10-10
3535
@page
3636
@vskip 0pt plus 1filll
3737
@insertcopying
@@ -658,6 +658,7 @@ given as a two-character ASCII representation where the first
658658
character@ @math{r} indicates the rank and the second
659659
character@ @math{s} gives the suit.
660660

661+
@float Table
661662
@multitable {Character} {Queen}
662663
@headitem
663664
Character
@@ -702,7 +703,9 @@ Character
702703
@code{J}
703704
@tab King
704705
@end multitable
705-
706+
@caption{Table 1: Rank (first) character of a card}
707+
@end float
708+
@float Table
706709
@multitable {Character} { Diamonds}
707710
@headitem
708711
Character
@@ -720,7 +723,8 @@ Character
720723
@code{S}
721724
@tab ♠ Spades
722725
@end multitable
723-
726+
@caption{Table 2: Suit (second) character of a card}
727+
@end float
724728
The optional argument @math{h} indicates the id of the player's hand
725729
being dealt. If it not present, that means the base hand. When
726730
performing a splitting on the base hand, the original hand has id equal
@@ -949,39 +953,47 @@ decks = 1 # number of decks, negative means infinite
949953
@item
950954
@code{blackjack_pays} (sec.@ 4.1.1)
951955
@item
952-
@code{dealer} (sec.@ 4.1.2)
956+
@code{cards} (sec.@ 4.1.2)
957+
@item
958+
@code{cards_file} (sec.@ 4.1.3)
953959
@item
954-
@code{decks} (sec.@ 4.1.3)
960+
@code{dealer} (sec.@ 4.1.4)
955961
@item
956-
@code{flat_bet} (sec.@ 4.1.4)
962+
@code{decks} (sec.@ 4.1.5)
957963
@item
958-
@code{hands} (sec.@ 4.1.5)
964+
@code{flat_bet} (sec.@ 4.1.6)
959965
@item
960-
@code{maximum_bet} (sec.@ 4.1.6)
966+
@code{hands} (sec.@ 4.1.7)
961967
@item
962-
@code{max_incorrect_commands} (sec.@ 4.1.7)
968+
@code{maximum_bet} (sec.@ 4.1.8)
963969
@item
964-
@code{new_hand_reset_cards} (sec.@ 4.1.8)
970+
@code{max_incorrect_commands} (sec.@ 4.1.9)
965971
@item
966-
@code{no_insurance} (sec.@ 4.1.9)
972+
@code{new_hand_reset_cards} (sec.@ 4.1.10)
967973
@item
968-
@code{number_of_burnt_cards} (sec.@ 4.1.10)
974+
@code{no_insurance} (sec.@ 4.1.11)
969975
@item
970-
@code{penetration} (sec.@ 4.1.11)
976+
@code{number_of_burnt_cards} (sec.@ 4.1.12)
971977
@item
972-
@code{penetration_sigma} (sec.@ 4.1.12)
978+
@code{penetration} (sec.@ 4.1.13)
973979
@item
974-
@code{player} (sec.@ 4.1.13)
980+
@code{penetration_sigma} (sec.@ 4.1.14)
975981
@item
976-
@code{quit_when_arranged_cards_run_out} (sec.@ 4.1.14)
982+
@code{player} (sec.@ 4.1.15)
977983
@item
978-
@code{rules} (sec.@ 4.1.15)
984+
@code{quit_when_arranged_cards_run_out} (sec.@ 4.1.16)
979985
@item
980-
@code{shuffle_every_hand} (sec.@ 4.1.16)
986+
@code{rng_seed} (sec.@ 4.1.17)
987+
@item
988+
@code{rules} (sec.@ 4.1.18)
989+
@item
990+
@code{shuffle_every_hand} (sec.@ 4.1.19)
981991
@end itemize
982992

983993
@menu
984994
* @code{blackjack_pays =} @math{r}::
995+
* @code{cards =} @math{\text{list of cards}}::
996+
* @code{cards_file =} @math{\text{path to file}}::
985997
* @code{dealer =} @emph{game}::
986998
* @code{decks =} @math{n}::
987999
* @code{flat_bet =} @math{b}::
@@ -995,6 +1007,7 @@ decks = 1 # number of decks, negative means infinite
9951007
* @code{penetration_sigma =} @math{r}::
9961008
* @code{player =} @emph{player}::
9971009
* @code{quit_when_arranged_cards_run_out =} @math{b}::
1010+
* @code{rng_seed =} @math{n}::
9981011
* @code{rules = [ ahc | enhc ] [ h17 | s17 ] [ das | ndas ] [ doa | do9 ]}::
9991012
* @code{shuffle_every_hand =} @math{b}::
10001013
@end menu
@@ -1013,6 +1026,71 @@ blackjack_pays = 1.5
10131026
blackjack_pays = 1.2
10141027
@end verbatim
10151028

1029+
@node @code{cards =} @math{\text{list of cards}}
1030+
@subsection @code{cards =} @math{\text{list of cards}}
1031+
If this option is given, the dealer draws the cards specified on the
1032+
list. In the first hand, the order of the dealt cards
1033+
1034+
@enumerate
1035+
@item
1036+
Player's first card
1037+
@item
1038+
Dealer's first card
1039+
@item
1040+
Player's second card
1041+
@item
1042+
@dots{}
1043+
@end enumerate
1044+
1045+
where the ellipsis dots indicate continuation of the game
1046+
(i.e.@ dealer's hole card for @code{ahc} or player's hit card for
1047+
`enhc).
1048+
1049+
These cards will be the ones specified on the list in the prescribed
1050+
order. Each card is given by a two-character string, explained in
1051+
tbl.@ 1 and tbl.@ 2 respectively. Cards should be separated by spaces.
1052+
1053+
The dealer will continue drawing from the list of arranged cards until
1054+
either
1055+
1056+
@enumerate a
1057+
@item
1058+
there are no more cards in the list, in which case the dealer will
1059+
continue drawing cards from either i. a shoe with the already-dealt
1060+
cards removed, if @code{decks} is non-zero, or ii. a set of infinite
1061+
cards , if @code{decks} is zero.
1062+
@item
1063+
the hand is over and @code{new_hand_reset_cards} is @code{true}, or
1064+
@item
1065+
@code{quit_when_arranged_cards_run_out} is true, in which case the
1066+
program exits.
1067+
@end enumerate
1068+
1069+
@strong{Default} Empty list
1070+
1071+
@strong{Examples}
1072+
1073+
@verbatim
1074+
cards = TH JD 6C
1075+
cards = 2S 5D QS AC
1076+
cards = 8D QH TC 2C KD 7S 8S TD AH 5C
1077+
@end verbatim
1078+
1079+
@node @code{cards_file =} @math{\text{path to file}}
1080+
@subsection @code{cards_file =} @math{\text{path to file}}
1081+
This option is exactly the same as @code{cards} but the cards are given
1082+
in a text file instead of directly in the configuration file.
1083+
1084+
@strong{Default} No path
1085+
1086+
@strong{Examples}
1087+
1088+
@verbatim
1089+
cards_file = cards.txt
1090+
cards_file = ../arranged_cards.txt
1091+
cards = /var/games/cards.txt
1092+
@end verbatim
1093+
10161094
@node @code{dealer =} @emph{game}
10171095
@subsection @code{dealer =} @emph{game}
10181096
Defines the game the dealer will deal. Currently, the only valid choice
@@ -1141,8 +1219,8 @@ reproducibility, it is easier to fix @code{rng_seed}.
11411219
@strong{Examples}
11421220

11431221
@verbatim
1144-
quit_when_arranged_cards_run_out = false
1145-
quit_when_arranged_cards_run_out = true
1222+
new_hand_reset_cards = false
1223+
new_hand_reset_cards = true
11461224
@end verbatim
11471225

11481226
@node @code{no_insurance =} @math{b}
@@ -1277,6 +1355,26 @@ quit_when_arranged_cards_run_out = false
12771355
quit_when_arranged_cards_run_out = true
12781356
@end verbatim
12791357

1358+
@node @code{rng_seed =} @math{n}
1359+
@subsection @code{rng_seed =} @math{n}
1360+
This option sets the seed of the random number generator used by the
1361+
dealer to draw cards. This is used to get deterministic results. That is
1362+
to say, the cards draw by two dealers using the same seed (and the same
1363+
number of decks) will be the same. It is not possible to guess what the
1364+
cards will be given a certain seed@ @math{n}. But the cards will be the
1365+
same for two executions of the program with the same seed@ @math{n}. If
1366+
this option is not set, the seed itself is as random as possible.
1367+
1368+
@strong{Default} Entropic non-deterministic random seed from C++'s
1369+
@code{std::random_device} (most likely @code{/dev/random}).
1370+
1371+
@strong{Examples}
1372+
1373+
@verbatim
1374+
rng_seed = 1
1375+
rng_seed = 123456
1376+
@end verbatim
1377+
12801378
@node @code{rules = [ ahc | enhc ] [ h17 | s17 ] [ das | ndas ] [ doa | do9 ]}
12811379
@subsection @code{rules = [ ahc | enhc ] [ h17 | s17 ] [ das | ndas ] [ doa | do9 ]}
12821380
Defines the rules of the game.

0 commit comments

Comments
 (0)