[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

562.0. "Streak Betting" by COMET::ROBERTS (Dwayne Roberts) Mon Aug 11 1986 16:48

    Charles Einstein, a reknowned expert at Blackjack, claims that if one
    uses the following betting strategy, one's expectation is increased: 
    
    (a) after the shuffle, make your first bet small (e.g., $2);
    (b) after a win, bet large (e.g., $10) until a loss;
    (c) after a loss, bet small (e.g., $2) until a win.
    
    He says that he's used this strategy of betting on streaks and has
    subsequently increased his winnings (over what he would have received
    had he bet the same amount ($6? $5.85?) on every hand). 
    
    [He also decries any mathematical discussion of "streak betting" that
    does not support his strategy.  In almost the same breath, he states
    that mathematicians and computer scientists are prejudiced if "reality"
    does not support their theories.] 

    After the first hand is played, the deck is either "enriched" or
    "depleted" in respect to future hands the player may receive and
    continues to change it's state as play progreses through the deck.
    Einstein claims that "streak betting" takes advantage of this
    situation. 
    
    All empirical tests I've performed with Blackjack, although very
    limited, do not support his strategy.  I'm examining some theoretical
    arguments that support the almost contrary strategy: 
    
    (a) after the shuffle, make your first bet small (e.g., $2);
    (b) after a win, bet SMALL (e.g., $2) until a loss;
    (c) after a loss, bet LARGE (e.g., $10) until a win.
    
    Discussion?                                         
    
T.RTitleUserPersonal
Name
DateLines
562.1Martingales...ENGINE::ROTHMon Aug 11 1986 17:446
    For info on such things, it may be worth looking into the theory of
    Martingales.  It's possible to calculate the probability of ruin fairly
    easily for some interesting situations...  I've never looked into this
    in great detail, but could locate some of the references I've seen.

    - Jim
562.2CLT::GILBERTeager like a childMon Aug 11 1986 18:183
    A small country near India decreed that a married couple could have
    no more children after they had had a son.  What affect did this
    have on the ratio of females to males in their country?
562.3Table for One Please...SYSENG::NELSONMon Aug 11 1986 18:476
    That strategy or a contrary one would seem to be practical only
    in head-to-head competition against the dealer.  As soon as another
    player sits down, their draw of cards would have a bearing on the
    deck being favorable or unfavorable towards the dealer.
    
    SN
562.4Betting WarCOMET::ROBERTSDwayne RobertsMon Aug 11 1986 19:1091
    The game of Blackjack is relatively complicated (with splits, double
    down, surrender, insurance, etc).  Consider this simpler, yet similar,
    game:
    
                                 Betting War
    
    Players:	Two, one of whom bets.
    Equipment:  Two "decks" of 3 shuffled cards.  Each deck contains a
    		card marked "S" (small), "M" (medium), and "L" (large).
    Game:	As in the children's game "War", each player turns up
    		his top card and compares it to the other player's.
    		L beats M beats S.  Ties are ignored.  Each "game"
    		consists of three "hands".
    Betting:	The betting player declares his betting strategy before
    		the game begins.  The bet of each hand, except for the
    		first hand of a game, must be based solely upon the
    		result of the last hand.  Each bet may be one of two
    		values:  "small" or "large".
    
    Let's compare all possible (and equally likely) hands of the game and
    the result of the "Einstein" strategy and the "Counter-Einstein"
    strategy.
    
    
    abbreviations:
    sw	small bet win
    lw	large bet win
    sl	small bet loss
    ll	large bet loss
    
    Two capital letters (e.g., SM) indicate the first player's (bettor's)
    card followed by the second player's card.  The example SM indicates
    the first player loses his bet (since S < M).
    
    The two strategies used are described in the base note.
    
      HAND	  Einstein   Counter-Einstein
     1  2  3	sw lw sl ll	sw lw sl ll
    == == ==	== == == ==	== == == ==
    SS MM LL	 0  0  0  0	 0  0  0  0
    SS ML LM	 1  0  1  0      0  1  1  0
    SM MS LL	 1  0  1  0	 0  1  1  0
    SM ML LS	 1  0  2  0	 0  1  1  1
    SL MS LM	 1  1  1  0	 1  1  1  0
    SL MM LS	 1  0  1  0	 0  1  1  0
    SS LM ML	 1  0  0  1	 1  0  1  0
    SS LL MM	 0  0  0  0	 0  0  0  0
    SM LS ML	 1  0  1  1	 0  1  2  0
    SM LL MS	 1  0  1  0	 0  1  1  0
    SL LS MM	 1  0  1  0	 0  1  1  0
    SL LM MS	 1  1  1  0	 1  1  1  0
    MS SM LL	 1  0  0  1	 1  0  1  0
    MS SL LM	 2  0  0  1	 1  1  1  0
    MM SS LL	 0  0  0  0	 0  0  0  0
    MM SL LS	 1  0  1  0	 0  1  1  0
    ML SS LM	 1  0  1  0	 0  1  1  0
    ML SM LS	 1  0  2  0	 0  1  1  1
    MS LM SL	 1  1  0  1	 2  0  1  0
    MS LL SM	 1  0  0  1	 1  0  1  0
    MM LS SL	 1  0  0  1	 1  0  1  0
    MM LL SS	 0  0  0  0	 0  0  0  0
    ML LS SM	 1  0  1  1	 0  1  2  0
    ML LM SS	 1  0  1  0	 0  1  1  0
    LS SM ML	 1  0  1  1	 1  0  1  1
    LS SL MM	 1  0  0  1	 1  0  1  0
    LM SS ML	 1  0  0  1	 1  0  1  0
    LM SL MS	 2  0  0  1	 1  1  1  0
    LL SS MM	 0  0  0  0	 0  0  0  0
    LL SM MS	 1  0  1  0	 0  1  1  0
    LS MM SL	 1  0  0  1	 1  0  1  0
    LS ML SM	 1  0  1  1	 1  0  1  1
    LM MS SL	 1  1  0  1	 2  0  1  0
    LM ML SS	 1  0  0  1	 1  0  1  0
    LL MS SM	 1  0  0  1	 1  0  1  0
    LL MM SS	 0  0  0  0	 0  0  0  0
		== == == ==	== == == ==
    		32  4 19 17	19 17 32  4
    
    For the Einstein strategy to be valuable,
    32 small bets + 4 large bets > 19 small bets + 17 large bets
                   13 small bets > 13 large bets
                    1 small bet  >  1 large bet
    which requires the small bet to be larger than the large bet - a
    contradiction.

    For the counter-Einstein strategy to be valuable,
    19 small bets + 17 large bets > 32 small bets + 4 large bets
                    13 large bets > 13 small bets
                     1 large bet  >  1 small bet
    which is valid by definition.
    
562.5Multiple PlayersCOMET::ROBERTSDwayne RobertsMon Aug 11 1986 20:089
    I like the analagous puzzle in .2, but question whether it really
    parallels the problem since having a female child should have no
    bearing upon whether the next child is male of female.  In other
    words, it doesn't "enrich" the "remainder of the deck".
    
    .3 brings up an interesting point.  Should the existence of additional
    players alter the betting strategy?  What happens in the "Betting
    War" game when two players bet against the third?
    
562.6Boys & GirlsCHOVAX::YOUNGChi-SquareMon Aug 11 1986 23:5510
    Re .2
    
    
>        A small country near India decreed that a married couple could have
>    no more children after they had had a son.  What affect did this
>    have on the ratio of females to males in their country?

    
    None.
    
562.7Here's a good referenceMODEL::YARBROUGHTue Aug 12 1986 18:258
    The best and most readable book I have seen on this topic is Richard
    A. Epstein's "The Theory of Gambling and Statistical Logic", Academic
    Press 1967. Among other things, it discusses Martingales and
    anti-Martingales, etc.
    
    Einstein's hypotheses about batches and runs are so much noise.
    Unfortunately, Blackjack is so even a game that he probably will
    not lose what he deserves to ...
562.8Bet big before winning ...VIRTUE::HALLYBFree the quarks!Tue Aug 12 1986 21:2513
    I've been looking for Epstein's book for a L-O-N-G time; it's out
    of print.
    
    Anyhow, I think it's dead wrong to increase your bet after a
    win because a win tends to make the deck less favorable.  If you
    get a blackjack on hand 1, the odds of you getting another one
    are much reduced (an ace-rich deck favors the player, a 5-rich
    deck favors the house).  I think one could show this by brute
    enumeration of, say, all possibilities of single-deck shuffles.
    (Quiz: how many ways are there to shuffle a 52-card deck when 
    suits don't count and all ten-values are the same?)
    
      John
562.9Blackjack strategy and expected valueSSDEVO::LARYThu Aug 14 1986 16:51403
While we are on the subject of Blackjack, the following program calculates
the optimal static (non-counting) Blackjack strategy for a game with an
infinite number of decks, as well as the expected value of the game. Its
probably not useful in resolving the "streak" problem (but intuitively, the
betting system in .0 is a lot of hooey) but some of you may find it useful.

Caveats:

1)	Its written in FORTRAN - language snobs should hit "n" immediately!
2)	Its 7 years old and I can't vouch for all the algorithms used, although
	I do remember it came out with the same strategy as the old Rand
	Corporation program for an infinite number of decks.

							Richie

C
C	BLACKJACK DECISION TABLE GENERATOR         R. LARY  7/17/79
C
C	Modified from PDP-11 FORTRAN to VAX FORTRAN 8/14/86
C
	IMPLICIT INTEGER*2(A-Z)
	REAL*8 P(10,27), PA(27), XU, EV, X, Y, W(11)
	REAL*8 STAND(10,21), HIT(10,21), AHIT(10,21), HIT5(10,21)
	REAL*8 DBLDN(10,21), DBLDNS(10,21), SPLIT(10,21)
	LOGICAL SPDD, SP3ACE, SPHACE, DBDALL, DLHS17, SRENDR
	LOGICAL SIXCC, BJ2TO1, DLRPSH
C
C	HOUSE RULES SETUP
C
C	SPDD = double down allowed after split
C	SP3ACE = re-splitting allowed after splitting aces
C	SPHACE = hitting allowed after splitting aces
C	DBDALL = double down on all values allowed (only 10 and 11 if false)
C	DLHS17 = dealer must hit soft 17
C	SRENDR = surrender allowed
C	SIXCC = "six card charlie" beats all dealer hands
C	BJ2TO1 = Blackjack pays 2:1
C	DLRPSH = dealer pushes (wins on ties when total less than 21)
C
C	The following rules are pretty much what is played in Las Vegas
C
	SPDD = .TRUE.
	SP3ACE = .TRUE.
	SPHACE = .FALSE.
	DBDALL = .TRUE.
	DLHS17 = .FALSE.
	SRENDR = .FALSE.
	SIXCC = .FALSE.
	BJ2TO1 = .FALSE.
	DLRPSH = .FALSE.
C
C	W(I) = PROBABILITY OF CARD VALUE I TURNING UP.
C
	CALL DEAL(W)
C
C	COMPUTE DEALER'S FINAL POINT DISTRIBUTION AS A FUNCTION
C	OF HIS INITIAL FACE-UP CARD IN BLACKJACK
C
C	NOTE: SINCE THIS COMPUTATION IS TO DETERMINE PLAYING STRATEGY,
C	DEALER BLACKJACKS HAVE BEEN EXCLUDED FROM THIS DISTRIBUTION.
C
C	DURING THIS PHASE, P(UP,N) = PROB OF DEALER HOLDING EXACTLY
C		N POINTS WITH NO ACES OR HARD ACES AND UP-CARD "UP"
C	PA(N)= PROB OF DEALER HOLDING N POINTS WITH SOFT ACES
C		(SOFT ACES HAVE VALUE 1 BUT CAN GO TO 10)
	TYPE 80
80	FORMAT(' PRINT LEVEL?'$)
	ACCEPT 90, PLVL
90	FORMAT(I3)
	IF(PLVL .LE. 0) TYPE 100
100	FORMAT('    DEALER''S PROBABILITY OF BEATING A GIVEN SCORE'//
	1 ' UP CARD   P(>16) P(>17) P(>18) P(>19) P(>20)  P(BUST)'/)
C
C	DECIDE WHETHER DEALER MUST HIT ON SOFT 17'S OR NOT
C
	IHLIMT = 7
	IF(DLHS17) IHLIMT = 8
C
C	START DEALER DISTRIBUTION LOOP HERE
C
	DO 200 UP=1,10
	XU = 1.
C
C	IF FACE CARD = 10, ONLY 12 UNDERCARDS (ACE WOULD BE BLACKJACK)
C
	IF(UP .EQ. 10) XU = 1. - W(1)
	DO 110 I=1,27
	P(UP,I) = 0.
110	PA(I) = 0.
C
C	COMPUTE BASIC (2-CARD) POINT DISTRIBUTION FOR FACE-UP CARD "UP"
C
	IF(UP .EQ. 1) GO TO 130
	DO 120 I=2,10
120	P(UP,UP+I) = W(I) / XU
	IF(UP .EQ. 10) GO TO 160
	IF(UP+1 .GE. IHLIMT) P(UP,UP+11) = W(1)
	IF(UP+1 .LT. IHLIMT) PA(UP+1) = W(1)
	GO TO 160
C
C	WITH ACE SHOWING, ONLY 9 UNDERCARDS ( 10/PICTURE IS BLACKJACK)
C
130	XU = 1. - W(10)
	DO 140 I=1,9
	IF(I+1 .GE. IHLIMT) P(UP,I+11) = W(I) / XU
140	IF(I+1 .LT. IHLIMT) PA(I+1) = W(I) / XU
C
C	SIMULATE DEALER HITS BY ADVANCING ALL POINT VALUES UNDER 16
C
160	DO 180 IP=UP+1,16
	DO 170 NC=2,10
C
C	AUGMENT ACELESS (OR HARD-ACED) DISTRIBUTION
C
	P(UP,IP+NC) = P(UP,IP+NC) + P(UP,IP)*W(NC)
C
C	SOFT HANDS MAY HARDEN AT 1, HARDEN AT 10 OR REMAIN SOFT
C	DEPENDING ON THE POINT RANGE THEY FALL INTO,
C	SINCE DEALER MUST STAND ON ALL 17'S OR ABOVE
C
	IF(IP+NC .GT. 11)P(UP,IP+NC) = P(UP,IP+NC) + PA(IP)*W(NC)
	IF(IP+NC .LE. 11 .AND. IP+NC .GE. IHLIMT)
	1 P(UP,IP+NC+10) = P(UP,IP+NC+10) + PA(IP)*W(NC)
170	IF(IP+NC .LT. IHLIMT)PA(IP+NC) = PA(IP+NC) + PA(IP)*W(NC)
C
C	HANDLE ACE HITS - MAIN DIFFERENCE HERE IS THAT AN ACE HIT
C	CAN "SOFTEN" AN ACELESS HAND OF LESS THAN (OR EQ IF DLHS17) 6 POINTS
C
	X = (P(UP,IP)+PA(IP)) * W(1)
	IF(IP .GT. 10) P(UP,IP+1) = P(UP,IP+1) + X
	IF(IP+1 .GE. IHLIMT .AND. IP .LE. 10)
	1 P(UP,IP+11) = P(UP,IP+11) + X
	IF(IP+1 .LT. IHLIMT) PA(IP+1) = PA(IP+1) + X
C
C	KEEP THE TOTAL PROBABILITY SUM AT 1.0 BY CLEARING OLD POINTPROB
C
	P(UP,IP) = 0.
180	PA(IP) = 0.
C
C	ADD UP THE BUST VALUES FOR A SUMMARY BUST SCORE
C	AND TURN POINT PROBABILITIES INTO CUMULATIVE ONES
C
	X = P(UP,22) + P(UP,23) + P(UP,24) + P(UP,25) + P(UP,26)
	DO 190 I=21,2,-1
190	P(UP,I-1) = P(UP,I-1) + P(UP,I)
	P(UP,22) = 0.
C
C	P(UP,N) IS NOW THE PROBABILITY THAT THE DEALER WILL EQUAL OR BEAT
C	THE VALUE N WITHOUT BUSTING IF HIS UP-CARD IS "UP"
C
200	IF(PLVL .LE. 0) TYPE 205,UP,(P(UP,I),I=17,21),X
205	FORMAT(I4,5X5(2PF6.1,'%'),2X2PF6.1,'%')
C
C	NOW COMPUTE STAND(UP,N) =  THE EFFECTIVE VALUE OF A $1 BET
C	IF WE STAND WITH "N" POINTS AGAINST A DEALER WITH "UP" SHOWING
C
	DO 210 I=2,21
	DO 210 UP=1,10
C
C	EV = 2 * (1 - P(UP,N))   +   1 * (P(UP,N) - P(UP,N+1))
C
	STAND(UP,I) = 2.0 - P(UP,I) - P(UP,I+1)
210	IF(DLRPSH .AND. I .NE. 21) STAND(UP,I) = 2.0 - 2.0 * P(UP,I)
C
C	NOW ITERATIVELY COMPUTE EFFECTIVE VALUE OF TAKING HIT(S)
C	HIT(UP,N) = EV OF HITTING A HARD "N" WHEN THE DEALER SHOWS "UP"
C	AHIT(UP,N)= EV OF HITTING A SOFT "N" WHEN THE DEALER SHOWS "UP"
C	HIT5(UP,N)= EV OF HITTING 5-CARD "N" WHEN THE DEALER SHOWS "UP"
C		(ONLY USEFUL IN GAMES WITH THE "SIX-CARD-CHARLEY" RULE)
C
C	HIT EV'S ARE BASED ON THE FACT THAT YOU WILL KEEP HITTING UNTIL
C	YOU REACH A POINT WHERE THE EV OF STANDING IS HIGHER AND THEN STAND;
C	THUS HIT(UP,N) = F( HIT(UP,N+J) , AHIT(UP,N+11) , STAND(UP,N+J) ).
C	THE ITERATION IS NEEDED BECAUSE SOFT HANDS SOMETIMES DECREASE IN
C	VALUE AFTER A HIT, MAKING AHIT(UP,N) ALSO A FUNCTION OF HIT(UP,N-I).
C
	DO 260 UP=1,10
	DO 220 I=1,21
	AHIT(UP,I) = 0.
	HIT5(UP,I) = 0.
220	HIT(UP,I) = 0.
	DO 260 ITER=1,2
	DO 260 I=20,1,-1
	X = 0.
	HIT5(UP,I) = 2.0 * W(1)
	IF(I .EQ. 20) GO TO 245
	DO 240 J=I+2,MIN0(I+10,21)
	HIT5(UP,I) = HIT5(UP,I) + 2.0 * W(J-I)
240	X = X + DMAX1(STAND(UP,J),HIT(UP,J)) * W(J-I)
245	IF(I .GT. 10) X = X + DMAX1(STAND(UP,I+1),HIT(UP,I+1)) * W(1)
	IF(I .LE. 10)X = X + DMAX1(STAND(UP,I+11),AHIT(UP,I+11)) * W(1)
	HIT(UP,I) = X
	IF(I .LT. 11) GO TO 260
	IF(I .GT. 11)AHIT(UP,I) = DMAX1(STAND(UP,I),HIT(UP,I)) * W(10)
	IF(I .EQ. 11) AHIT(UP,I) = STAND(UP,21) * W(10)
	DO 250 J=I+1,I+9
	X = 0.
	IF(J .LE. 21) X = DMAX1(STAND(UP,J),AHIT(UP,J))
250	AHIT(UP,I) = AHIT(UP,I) +
	1 DMAX1(X,STAND(UP,J-10),HIT(UP,J-10)) * W(J-I)
260	CONTINUE
	IF(PLVL .LE. 1) TYPE 270,(I,I=1,10)
270	FORMAT(//' PROBABILITY OF WINNING IF YOU STAND'
	1/25X'Dealer shows'/'   ON',10I6/)
	IF(PLVL .LE. 1) TYPE 280,(I,(STAND(UP,I)/2.,UP=1,10),I=16,21)
280	FORMAT((I5,2X10(2PF5.1,'%')))
	IF(PLVL .LE. 1) TYPE 285,(I,I=1,10)
285	FORMAT(//' PROBABILITY OF WINNING IF YOU HAVE NO ACE AND HIT'/
	1 25X'Dealer shows'/'   TO',10I6/)
	IF(PLVL .LE. 1) TYPE 280,(I,(HIT(UP,I)/2.,UP=1,10),I=4,20)
	IF(PLVL .LE. 1) TYPE 290,(I,I=1,10)
290	FORMAT(//' PROBABILITY OF WINNING IF YOU HAVE AN ACE AND HIT'/
	1 25X'Dealer shows'/'   TO',10I6/)
	IF(PLVL .LE. 1) TYPE 280,(I,(AHIT(UP,I)/2.,UP=1,10),I=11,20)
	IF(PLVL .LE. 2) TYPE 295,(I,I=1,10)
295	FORMAT(//'    WHAT SHOULD YOU DO HOLDING NO ACE?'
	1/25X'Dealer shows'/'   ON',10I4/)
	IF(PLVL .LE. 2) CALL PDTBL(STAND,HIT,HIT,1.D0,0.D0,12,20,-1)
	IF(PLVL .LE. 2) TYPE 305,(I,I=1,10)
305	FORMAT(//'   WHAT SHOULD YOU DO HOLDING AN ACE?'
	1/25X'Dealer shows'/'   ON',10I4/)
	IF(PLVL .LE. 2) CALL PDTBL(STAND,AHIT,AHIT,1.D0,0.D0,12,20,-1)
	IF(SIXCC .AND. PLVL .LE. 2) TYPE 310,(I,I=1,10)
310	FORMAT(//'   WHAT SHOULD YOU DO HOLDING 5 CARDS?'
	1/25X'Dealer shows'/' WITH',10I4/)
	IF(SIXCC .AND. PLVL .LE. 2)
	1 CALL PDTBL(STAND,HIT5,HIT5,1.D0,0.D0,10,20,-1)
C
C	COMPUTE EXPECTED VALUES FOR DOUBLE-DOWN
C
	DO 330 UP=1,10
C
C	START OFF WITH ACE COMPONENT WHICH IS VERY DIFFERENT FOR 10 AND 11
C
	DO 330 I=2,20
	IF(I .LE. 10) DBLDN(UP,I) = STAND(UP,I+11) * W(1)
	IF(I .GT. 10) DBLDN(UP,I) = STAND(UP,I+1) * W(1)
	IF(I .GE. 20) GO TO 330
	DO 320 FACEDN=2,MIN0(10,21-I)
320	DBLDN(UP,I) = DBLDN(UP,I) + STAND(UP,I+FACEDN)*W(FACEDN)
330	CONTINUE
	IF(PLVL .LE. 3) TYPE 340,(I,I=1,10)
340	FORMAT(//' PROBABILITY OF WINNING ON DOUBLE-DOWN'
	1/25X'Dealer shows'/' WITH',10I6/)
	IF(PLVL .LE. 3) TYPE 280,(I,(DBLDN(UP,I)/2.,UP=1,10),I=7,12)
	IF(PLVL .LE. 4) TYPE 350,(I,I=1,10)
350	FORMAT(//' SHOULD YOU DOUBLE-DOWN?'/25X'Dealer shows'/' WITH',10I4/)
	IF(PLVL .LE. 4) CALL PDTBL(DBLDN,HIT,STAND,2.D0,1.D0,7,12,1)
C
C	NOW CALCULATE EXPECTED VALUES FOR "SOFT" DOUBLE-DOWNS
C
	DO 353 UP=1,10
	DO 353 I=12,20
	DBLDNS(UP,I) = 0.
	DO 353 FACEDN=1,10
	X = STAND(UP,I+FACEDN-10)
	IF(I+FACEDN .LE. 21) X = DMAX1(X,STAND(UP,I+FACEDN))
353	DBLDNS(UP,I) = DBLDNS(UP,I) + X*W(FACEDN)
	IF(PLVL .LE. 3) TYPE 355,(I,I=1,10)
355	FORMAT(//' PROBABILITY OF WINNING ON DOUBLE-DOWN SOFT',
	1 ' (WITH ACE)'/25X'Dealer shows'/' WITH',10I6/)
	IF(PLVL .LE. 3)TYPE 280,(I,(DBLDNS(UP,I)/2.,UP=1,10),I=12,20)
	IF(PLVL .LE. 4) TYPE 358,(I,I=1,10)
358	FORMAT(//' SHOULD YOU DOUBLE-DOWN SOFT?'
	1/25X'Dealer shows'/' WITH',10I4/)
	IF(PLVL .LE. 4) CALL PDTBL(DBLDNS,AHIT,STAND,2.D0,1.D0,12,20,1)
C
C	CALCULATE EXPECTED VALUE OF SPLITS TO ONE LEVEL,
C
	DO 360 UP=1,10
	SPLIT(UP,1) = DBLDN(UP,11)
	IF(SPHACE) SPLIT(UP,1) = AHIT(UP,11)
	DO 360 I=2,10
	X = HIT(UP,I)
C
C	TAKE INTO ACCOUNT SPLIT-INITIATED DOUBLE-DOWNS ON 10 AND 11
C
	IF(SPDD .AND. I .LT. 10) X = X +
	1 (DMAX1(2.*DBLDN(UP,11)-1.,HIT(UP,11))-HIT(UP,11)) * W(11-I)
	IF(SPDD .AND. I .LT. 9  .AND.  I .NE. 5) X = X +
	1 (DMAX1(2.*DBLDN(UP,10)-1.,HIT(UP,10))-HIT(UP,10)) * W(10-I)
360	SPLIT(UP,I) = X
C
C	SINCE ANYTHING WORTH DOING IS WORTH DOING AGAIN,
C	TAKE NESTED SPLITS INTO ACCOUNT -
C
	DO 370 UP=1,10
	DO 370 I=1,10
	IF(I .EQ. 1 .AND. .NOT. SP3ACE) GO TO 370
C
C	COMPUTE Y = VALUE OF KEEPING PAIR (NOT SPLITTING FURTHER)
C
	IF(I .EQ. 1) Y = DMAX1(STAND(UP,12),AHIT(UP,12))
	IF(I .NE. 1) Y = DMAX1(STAND(UP,2*I),HIT(UP,2*I))
C
C	THE FORMULA USED HERE IS THE CLOSED FORM FINAL TERM OF THE SEQUENCE
C		X(N+1) = X(0) + W(I) * (2*X(N) - Y - 1)
C
	SPLIT(UP,I) = (SPLIT(UP,I) - W(I)*(Y+1.)) / (1. - 2.*W(I))
370	CONTINUE
	IF(PLVL .LE. 5) TYPE 380,(I,I=1,10)
380	FORMAT(//' SHOULD YOU SPLIT A PAIR?'
	1/25X'Dealer shows'/'   OF',10I4/)
	IF(PLVL .LE. 5)
	1 CALL PDTBL(SPLIT,AHIT(1,12),STAND(1,12),2.D0,1.D0,1,1,1)
	IF(PLVL .LE. 5)
	1 CALL PDTBL(SPLIT,HIT,STAND,2.D0,1.D0,2,10,2)
C
C	TAKE SURRENDER INTO ACCOUNT
C
	IF(SRENDR .AND. PLVL .LE. 5) TYPE 390,(I,I=1,10)
390	FORMAT(//' SHOULD YOU SURRENDER?'/25X'Dealer shows'/' WITH',10I4/)
	IF(SRENDR .AND. PLVL .LE. 5)
	1 CALL PDTBL(HIT,HIT,STAND,0.D0,-.5D0,14,17,1)
C
C	CALCULATE EXPECTED VALUE OF GAME USING BEST STRATEGIES
C
	EV = 0.
	DO 500 UP=1,10
	DO 500 M1=1,10
	DO 500 M2=1,10
	X = DMAX1(STAND(UP,M1+M2),HIT(UP,M1+M2))
	IF(SRENDR) X = DMAX1(X,.5D0)
	IF(M1 .EQ. M2) X = DMAX1(X, 2.*SPLIT(UP,M1)-1.)
	IF(M1 .EQ. 1  .OR.  M2 .EQ. 1) GO TO 470
C
C	DOUBLE DOWN ON 10 OR 11 ONLY IF SO RESTRICTED
C
	IF(M1+M2 .EQ. 10 .OR. M1+M2 .EQ. 11 .OR. DBDALL)
	1 X = DMAX1(X, 2.*DBLDN(UP,M1+M2)-1.)
	GO TO 480
470	X = DMAX1(X, AHIT(UP,M1+M2+10))
	IF(DBDALL) X = DMAX1(X, 2.*DBLDNS(UP,M1+M2+10)-1.)
	IF(M1+M2 .NE. 11) GO TO 480
C
C	BLACKJACK!
C
	X = 2.5
	IF(BJ2TO1) X = 2.0
	IF(UP .EQ. 1) X = X * (1.-W(10)) + W(10)
	IF(UP .EQ. 10) X = X * (1.-W(1)) + W(1)
	GO TO 500
480	IF(UP .EQ. 1) X = X * (1. - W(10))
	IF(UP .EQ. 10) X = X * (1. - W(1))
500	EV = EV + X*W(UP)*W(M1)*W(M2)
	IF(PLVL .LE. 6) TYPE 510,EV
510	FORMAT('0EXPECTED VALUE OF GAME IS ',F7.4)
	CALL EXIT
	END
	SUBROUTINE DEAL(W)
	IMPLICIT INTEGER*2(A-Z)
	REAL*8 W(11),X
C
C	W(I) = PROBABILITY OF CARD VALUE I TURNING UP.
C
	DO 40 I=1,10
40	W(I) = 1.0D0 / 13.0D0
	W(10) = 4.0D0 / 13.0D0
C
C	ALLOW CARD PROBABILITIES TO BE PERTURBED TO SIMULATE
C	COUNTING-DETECTED SITUATIONS
C
50	TYPE 55
55	FORMAT(' PERTURB?'$)
	ACCEPT 90, I
90	FORMAT(I3)
	IF(I .EQ. 0) GO TO 60
	IF(I .GT. 0) W(I) = W(I) * 1.05
	IF(I .LT. 0) W(-I) = W(-I) / 1.05
	GO TO 50
C
C	RE-NORMALIZE CARD PROBABILITIES SO THEY SUM TO 1.0
C
60	X = 0.
	DO 65 I=1,10
65	X = X + W(I)
	DO 70 I=1,13
70	W(I) = W(I) / X
	W(11) = W(1)
	RETURN
	END
	SUBROUTINE PDTBL(A,B,C,D,E,LOW,HI,M)
	REAL*8 A(10,21),B(10,21),C(10,21)
	REAL*8 D,E,X,Y
	INTEGER*2 LOW,HI,UP,I,M,CH,MM
	LOGICAL*1 DTABLE(10,21),YES(2),NO(2)
	DATA YES/'S','Y'/ , NO/'H','N'/
C
	CH = 1
	MM = M
	IF(M .GT. 0) CH = 2
	IF(M .LT. 0) MM = - M
	DO 100 I=LOW,HI
	DO 100 UP=1,10
	X = A(UP,I) * D - E
	Y = DMAX1(B(UP,I*MM),C(UP,I*MM))
	DTABLE(UP,I) = NO(CH)
	IF(X .GT. Y) DTABLE(UP,I) = YES(CH)
100	IF(50.*ABS(X-Y) .LT. DMAX1(X,Y)) DTABLE(UP,I) = DTABLE(UP,I)+32
	TYPE 110,(I,(DTABLE(UP,I),UP=1,10),I=LOW,HI)
110	FORMAT((I5,10(3XA1)))
	RETURN
	END
562.10Epstein book still in printCADM::ROTHIf you plant ice you'll harvest windFri Feb 05 1988 23:0120