Start bbjd to enter into interactive mode of bbjd.
bbjd may be used to test a playing session against the Blackjack
dealer. For real usage in a casino, the program would have to be modified
in order to attach it to a user interface which works with a few button-presses
inside Your trouser pocket and with some kind of earphone or mechanical feedback.
A graphical user-interface, even on Windows CE, would be pointless in a 
casino.

After You start bbjd, a prompt appears:
bbjd>
You now may enter one of the commands described in this text. You may enter more than
one command per line. However, some commands will execute immediately skipping the following
commands.


bbjd> help
or
bbjd> ?
prints a short help-text message.

To leave bbjd, just type
bbjd> exit
or
bbjd> quit

The command:

bbjd> show
--- Card distribution in shoe ---
Cards      2       3       4       5       6       7       8       9      10       A    Packs
 312      24      24      24      24      24      24      24      24      96      24       6
percent   7.7     7.7     7.7     7.7     7.7     7.7     7.7     7.7    30.8     7.7

prints out the actual card distribution in the shoe. You may modify the card distribution
with one of the following commands:

bbjd> ace-
decreases the amount of aces in the shoe by one.

bbjd> 6 = 20
set the amount of cards with value 6 to 20 cards in the shoe.

bbjd> 10---
decreases the amount of cards with value 10 by 3.

bbjd> 10+
increase the amount of cards with value of 10 by one.

bbjd> 3-- 4=15 7---

after executing the command 'show', the card distribution should look like this:
--- Card distribution in shoe ---
Cards      2       3       4       5       6       7       8       9      10       A    Packs
 291      24      22      15      24      20      21      24      24      94      23       6
percent   8.2     7.6     5.2     8.2     6.9     7.2     8.2     8.2    32.3     7.9

Note that You may never increase or decrease the amount of cards in the show to a value which
would not be possible with the chosen amount of packs. If packs is set to 6, the number of aces
can only be in the range from 0 to 24, the number of tens in the range from 0 to 96.

To reset the amount of cards in the shoe with fresh shuffled cards type
bbjd> shuffle
or
bbjd> reset

To change the number of packs in the shoe, type
bbjd> packs 4
--- Card distribution in shoe ---
Cards      2       3       4       5       6       7       8       9      10       A    Packs
 208      16      16      16      16      16      16      16      16      64      16       4
percent   7.7     7.7     7.7     7.7     7.7     7.7     7.7     7.7    30.8     7.7
this will reset the shoe with fresh shuffled cards.


To calculate all the probabilities and expectations for the actual card distribution
in the shoe, type
bbjd> run
on slow computers this may take a few seconds. Depending on which tables You have chosen to see,
the result may look like this:

=====================================================================================
--- Card distribution in shoe ---
Cards      2       3       4       5       6       7       8       9      10       A    Packs
 312      24      24      24      24      24      24      24      24      96      24       6
percent   7.7     7.7     7.7     7.7     7.7     7.7     7.7     7.7    30.8     7.7
--- Probability of dealers last hand under the condition of dealers first hand ---
dfh        2       3       4       5       6       7       8       9      10       A    TOTAL
p(dfh)    7.7     7.7     7.7     7.7     7.7     7.7     7.7     7.7    30.8     7.7   100.0
p(BUST)  35.4    37.4    39.6    41.8    42.3    26.2    24.4    22.9    21.2    11.5    28.2
p(BJ)     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     7.7    30.9     4.7
p(21)    11.8    11.5    11.2    10.8     9.7     7.4     6.9     6.1     3.5     5.4     7.3
p(20)    12.4    12.1    11.6    11.2    10.2     7.9     6.9    12.0    34.0    13.1    18.0
p(19)    13.0    12.5    12.1    11.8    10.6     7.8    12.9    35.2    11.2    13.1    13.4
p(18)    13.4    13.1    12.4    12.2    10.6    13.8    36.0    11.7    11.2    13.1    13.9
p(17)    14.0    13.4    13.1    12.2    16.6    36.9    12.9    12.0    11.2    13.0    14.5
--- Expectation for INSURANCE under the condition of dealers first hand is ACE ---
E(INSURE|ACE)                                                                    -7.4
--- Expectation for BUY contra STAY under the condition of dealers first hand ---
dfh        2       3       4       5       6       7       8       9      10       A
E(8/18)  -5.9    -5.8    -5.8    -5.3    -9.4   -23.0    -6.8     8.1     3.0     0.4
E(7/17)  15.2    14.5    13.8    13.5    11.5    15.9    30.8    26.4    20.2    20.5
E(16)   -17.9   -21.3   -24.8   -28.6   -27.7     6.1     5.4     3.2     0.0    10.3
E(15)   -12.6   -15.7   -18.9   -22.3   -21.3    10.5     9.4     6.8     3.2    12.7
E(14)    -7.1    -9.8   -12.7   -15.8   -14.8    15.3    13.9    11.0     6.7    15.5
E(13)    -1.6    -4.0    -6.6    -9.3    -8.2    20.7    18.8    15.4    10.6    18.6
E(12)     3.9     1.8    -0.5    -2.8    -1.7    26.3    24.0    20.1    14.7    21.8
--- Expectation for DOUBLE contra BUY under the condition of dealers first hand ---
dfh        2       3       4       5       6       7       8       9      10       A
E(11)    23.3    25.9    28.6    31.1    33.5    17.2    12.1     7.3    -1.8   -33.0
E(10)    17.8    20.6    23.4    26.1    29.0    13.9     9.1     3.3   -10.4   -37.1
E( 9)    -1.2     2.2     5.6     9.1    12.3    -6.4   -12.3   -24.4   -36.2   -55.9
--- Expectation for SPLIT contra BUY/STAY for splitting player (default rule) ---
dfh        2       3       4       5       6       7       8       9      10       A
E(A-A)   39.5    42.0    44.7    46.6    48.8    30.6    26.2    23.8    16.1   -21.2
E(2-2)   -3.5    -1.5     0.8     4.4     6.7     3.4    -4.7   -13.9   -25.5   -41.4
E(3-3)   -5.9    -2.9     0.5     4.1     6.4     4.2    -4.0   -13.4   -25.1   -41.1
E(4-4)  -21.1   -17.5   -13.7    -9.4    -9.6   -26.6   -26.4   -27.4   -38.3   -52.5
E(5-5)  -44.5   -40.2   -35.5   -30.5   -29.6   -51.0   -58.9   -66.5   -69.1   -76.0
E(6-6)   -2.3     2.6     7.1    10.5    13.1    -8.4   -15.8   -24.3   -34.5   -48.4
E(7-7)    7.7    10.1    13.0    15.9    21.5    19.3    -4.2   -13.0   -22.6   -42.7
E(8-8)   25.1    27.0    29.3    31.5    38.7    58.2    33.9     8.9    -3.7   -22.4
E(9-9)    2.5     5.3     8.2    11.9    10.7    -5.8     9.1     8.0   -19.4   -33.0
E(10-K) -28.0   -24.3   -20.3   -15.9   -13.4   -26.3   -40.1   -53.1   -54.5   -65.3
--- Probability of players last hand (when played with optimal strategy) ---
dfh        2       3       4       5       6       7       8       9      10       A    TOTAL
p(BUST)   3.3     3.1     0.0     0.0     0.0    26.1    26.5    26.9    28.8    29.0    17.7
p(BJ)     4.7     4.7     4.7     4.7     4.7     4.7     4.7     4.7     4.7     4.7     4.7
p(21)     3.8     3.7     2.9     2.9     2.9     7.3     7.3     7.5     7.8     7.7     5.9
p(20)    14.4    14.3    13.5    13.5    13.5    17.8    17.9    18.1    18.3    18.4    16.5
p(19)     9.9     9.9     9.1     9.1     9.1    13.3    13.4    13.6    13.7    13.8    12.0
p(18)     9.9     9.9     9.1     9.1     9.1    14.0    13.4    12.2    12.9    12.9    11.6
p(17)     9.8     9.7     9.0     9.0     9.0    13.2    13.1    13.3    13.5    13.6    11.8
p(16)     9.7     9.8     8.9     8.9     8.9     0.7     0.7     0.7     0.0     0.0     3.7
p(15)    10.9    10.9    10.1    10.1    10.1     0.7     0.7     0.7     0.0     0.0     4.2
p(14)    10.9    10.8     9.9     9.9     9.9     0.7     0.7     0.7     0.0     0.0     4.1
p(13)    12.0    12.0    11.3    11.3    11.3     0.7     0.7     0.7     0.0     0.0     4.6
p(12)     0.7     1.0    11.1    11.1    11.1     0.7     0.7     0.7     0.0     0.0     2.9
p(11)     0.0     0.3     0.3     0.3     0.3     0.0     0.0     0.0     0.0     0.0     0.1
--- Final expectation (when played with optimal strategy) ---
dfh        2       3       4       5       6       7       8       9      10       A    TOTAL
expect:   8.9    12.0    15.5    19.2    22.3    14.2     5.7    -4.1   -17.7   -34.0   -0.849%

This prints out eight tables with more or less interesting probabilities and expectations.
To understand what these numbers mean, read 'Theory'. To play according to the optimal strategy,
look at the tables 'Expectation for BUY contra STAY', 'Expectation for DOUBLE contra BUY' and
'Expectation for SPLIT contra BUY/STAY'.
dfh means 'dealers first hand' and this is the first card of the dealer you can see.
The players best strategy differs according to 'dfh', so get the intersection field of the column
of 'dfh' with the row for the decision You have to do. If the expectation is above 0 do it, if
the expectation is below 0 don't do it. For instance: dealers first hand is 9, Your hand is 15.
The question is: should You buy or should you stay? The table tells the answer: expectation for
buy contra stay is 6.8, so You should buy! The same rule must be applied for decisions to split
or the double. Note that with a different card distribution in the shoe, the optimum strategy also
slightly differs.
One decision to do, is to place bets. This must be done before the game starts. If the total
expectation is below 0, the minimum stake for the table limit should be placed. If the total
expectation is above 0, a higher stake should be placed. It is difficult to say how much, this
depend on how much money is available and how risky You want to play. 
Always remember: A total expectation above 0 does not mean that automatically You will win the game,
it only means Your probabilities to win on the long term are better than the dealers ones (provided
that You play according to the optimal strategy described with the tables above).

If You are interested in only a few of the tables, You may hide all or some of them by typing
bbjd> hide all
bbjd> display final display buy
This command will only show the tables 'Expectation for BUY contra STAY'
and 'Final expectation' for the queries and calculations which will follow.
The command 'display' or 'hide' may be followed by one of the tables:
all, final, cards, dealer, buy, insurance, double, partner, player or none.
The tables 'dealer' and 'player' are only interesting for experimental purpose,
they are not needed to beat the dealer, so it is safe to call
bbjd> hide dealer hide player
The table 'partner' is only of interest, if two or more players try to beat the dealer
as a team. Refer to 'Theory' to get more information.

Do not confuse probabilities with expectations. Probabilities are always in the range
0..1 (or 0%..100%). A probability tells you how often You will win a game on the
long term. An expectation tells You how much money You will win on the long term.
an expectation of +1% means, that on the long term, You win 1 dollar, if Your stake is
100 dollars per bet.
A probability of 30% means, that You will win 30 games and the dealer will win 70 games.
We are interested in winning money, therefore the expectation is the number to look at,
not the probability. Probabilities and expectations relate always to the composition
of the cards in the shoe. As the composition of cards is always different, it is difficult
to speak about "on the long term". Probabilities and expectations can only be regarded as
theoretical numbers as the same composition of cards can not be reproduced in the shoe.

To prove that this theory works on the long term, the program simulate has been written.
It uses the same algorithm, but simulates bets against the dealer.
