   // Hi-Lo, playing indices for true counts in the range from -10 to +10
// The playing indices are not complete for no DAS, H17, and no hole card

// First, basic strategy follows.  After a complete basic strategy, 
// definition of playing indexes continues.

// NOTE: the indices are reversal for:
// splitting 8,8 vs. T, 8,8 vs. 9, 3,3 vs. 7, and late surrender 17 vs. A up

// Since following is only a basic strategy, all numbers are either -99 or 99

Insurance = 99;   // Do not buy insurance

if  (DECK1)    // Basic strategy specification for 1 deck
  // standing and hitting
	H7710 	= -99;  // stand on 7,7 vs. 10 up (do not hit 7,7 vs. 10 up)

  if (H17)
	SH18A  	=  99;  // hit soft 18 vs. A up if H17
  else
	SH18A  	= -99;  // stand on (do not hit) soft 18 vs. A up if S17 
  endif

  // hard doubling	
	HD11A	= -99;	// double hard 11 vs. A
	HD92	= -99; 	// double hard 9 vs. 2
	HD85	= -99;
	HD86 	= -99;  // double hard 8 vs. 5 or 6 up
  
  // soft doubling
	SDA86	= -99; 	// double soft 19 vs. 6
        SDA72	=  99;  // do not double soft 18 vs. 2
	SDA62	= -99;  // double soft 17 vs. 2
	SDA34   = -99;  // double soft 14 vs. 4
	SDA24   = -99;  // double soft 13 vs. 4

  // pair splitting
	SP62 	= -99; 	// split 6s vs. 2
	SP23    = -99; 	// split 2s vs. 3

  if (DAS)    // if DAS is allowed
	SP78    = -99; 	// split 7s vs 8 if DAS is allowed
	SP67	= -99;	// split 6s vs 7 if DAS
	SP44	= -99;	// split 4s vs 4 if DAS
	SP38	= -99;  // split 3s vs 8 if DAS
  
    if (H17)
	SP9A 	= -99;  // split 9s vs A if DAS and H17
    else 
	SP9A 	=  99;  // do not split 9s vs A for S17
    endif
	
  else        // DAS is not allowed
	SP9A 	=  99;  // do not split 9s vs A for no DAS
	SP78    =  99; 	// do not split 7s vs 8 if DAS is not allowed
	SP67    =  99;  // do not split 6s vs 7 if DAS is not allowed
	SP44	=  99; 	// do not split 4s vs 4 if DAS is not allowed
	SP38	=  99;  // do not split 3s vs 8 if no DAS
  endif


  // surrender
	SU7710	= -99;  // surrender 7,7 vs. 10 up
	SU169	=  99;  // do not surrender 16 vs. 9

else  	// Multidecks basic strategy; the deviations for 2 decks will follow

  // standing and hitting
	H7710 	=  99; 	// hit 7,7 vs. 10 up 
	SH18A  	=  99;  // hit soft 18 vs. A up 

  // hard doubling	

 if (H17) 
	HD11A	= -99;	// double hard 11 vs. A if H17
	SDA86	= -99; 	// double soft 19 vs. 6 if H17
	SDA72	= -99;  // double soft 18 vs. 2 if H17
 else
	HD11A	=  99;	// do not double hard 11 vs. A if S17
	SDA86	=  99; 	// do not double soft 19 vs. 6 if S17
	SDA72	=  99;  // do not double soft 18 vs. 2 if S17
 endif

	HD92	=  99; 	// do not double hard 9 vs. 2
	HD85	=  99;
	HD86 	=  99;  // do not double hard 8 vs. 5 or 6 up
  
  // soft doubling
	SDA62	=  99;  // do not double soft 17 vs. 2
	SDA34   =  99;  // do not double soft 14 vs. 4
	SDA24   =  99;  // do not double soft 13 vs. 4

  // pair splitting
	SP9A 	=  99;  // do not split 9s vs A
	SP38	=  99;  // do not split 3s vs 8

 if (Not DAS)    // DAS is not allowed
	SP62 	=  99; 	// do not split 6s vs. 2 (used only for no DAS case)
	SP23    =  99; 	// do not split 2s vs. 3 (used only for no DAS case)
 
 else 		 // DAS is allowed
  	SP62	= -99;  // split 6s vs. 2 if DAS is allowed
	SP23	= -99;  // split 2s vs. 3 if DAS is allowed
 endif

	SP78    =  99; 	// do not split 7s vs 8 even if DAS is allowed
	SP67	=  99;	// do not split 6s vs 7 eve if DAS
	SP44	=  99;	// do not split 4s vs 4 even if DAS

  // surrender
	SU7710	=  99;  // do not surrender 7,7 vs. 10 up
	SU169	= -99;  // surrender hard 16 vs. 9 
                    // with the exception of 8,8 of course
endif  // 1 deck versus multideck basic strategy


if  (DECK2)	// deviations from multideck basic strategy for 2 decks

  // hard doubling
	HD11A   = -99;  // double hard 11 vs. ace up
	HD92	= -99;  // double hard 9 vs. 2

 if (H17)
	SDA34  	= -99;	// double soft 14 vs. 4 if H17
 else
	SDA34  	=  99;	// do not double soft 14 vs. 4 if S17
 endif

  // surrender
	SU169   =  99;  // do not surrender hard 16 vs. 9	

  // pair splitting
	SP62 	= -99;  // split 6s vs. 2 for both DAS and no DAS

  if (DAS)
	SP78	= -99;  // split 7s vs. 8 for DAS
	SP67 	= -99;  // split 6s vs. 7 for DAS
  endif 

endif     // 2 decks deviations


// SPECIAL RULES ADJUSTMENTS (H17, no hole card)

if  (H17)  	// dealer hits soft 17
        SU17A   =  99;  // reversal index; always surrender
else 
        SU17A   = -99;  // reversal index; never surrender
endif


if  (HC) 	// dealer has a hole card -- checks for blackjack
 	SU8810	=  99;  // do not surrender 8,8 vs. 10 (split)
        HD1110  = -99;  // double hard 11 vs. 10 up
        SP810   =  99;  // split 8,8 vs. 10 up; reversal index (!)
        SP8A    = -99;  // split 8,8 vs. Ace up; normal index
	SPAA	= -99;  // split A,A vs. Ace up; normal index

else  // no hole card, all splits and doubles lost versus dealer's blackjack
 	SU8810  = -99;  // surrender 8,8 vs. 10
	HD1110  =  99;  // do not double hard 11 vs. 10 up
	HD11A	=  99;  // do not double hard 11 vs. Ace up
     	SP810   = -99;  // do not split 8s vs. 10 up; reversal index (!)
	SP8A	=  99;  // do not split 8s vs. Ace up
	SPAA	=  99;  // do not split A,A vs. Ace up
	SP9A 	=  99;  // do not split 9,9 vs. Ace up
endif

if (ES or E10S)
	SU7710	= -99;	// surrender 7,7 vs. 10 up if early surrender vs. 10
	SU8810	= -99;	// surrender 8,8 vs. 10 up if early surrender vs. 10
endif


// AND NOW THE PLAYING INDICES

// Only differences from BS are specified

	INSURANCE = 3;	// Buy insurance if true count >= 3

if (HC)
 if (DECK1)
	SU8810	=  2;  // Surrender 8,8 vs. 10 if TC >= 2 for 1 deck
	SU7710	= -1;  // Surrender 7,7 vs. 10 if TC >=-1 for 1 deck

 else   // More than 1 deck
	SU8810 	=  1;  // Surrender 8,8 vs. 10 if TC >= 1
	SU7710 	=  2;  // Surrender 7,7 vs. 10 if TC >= 2
 endif 
endif

if (NOT HC OR ES)	// European no hole card or early surrender allowed
 if (HC)
	SU8810	= -2;	// Surrender 8,8 vs. 10 up if TC >= -2
 else 	// European no hole card
	SU8810 	= -6;	// Surrender 8,8 vs. 10 up if TC >= -6
 endif

 if (DECK1)  	
	SU7710	= -4;	// Surrender 7,7 vs. 10 up if TC >= -4
 else 	// More than one deck
	SU7710 	= -2; 	// Surrender 7,7 vs. 10 up if TC >= -2
 endif
endif

if (DECK1) 
	H7710	=  0;  // Stand on 7,7 vs. 10 if TC >= 0

else if (DECK2)
	H7710	=  4;  // Stand on 7,7 vs. 10 if TC >= 4 for two decks game

 else 	// more than 2 decks
	H7710	=  9;  // Same as hitting regular hard 14 
 endif
endif

if (DECK1 and NOT H17)
      	SH18A 	=  0;  // standing on soft 18 if TC >= 0
endif 

if (NOT DECK1 and NOT H17)
	SH18A	=  1;  // standing on soft 18 if TC >= 1	
endif

if (NOT DECK1 and DAS)
 	SP78	=  5; // for more than 1 deck, split 7,7 vs. 8 if TC >= 5
endif

// For all decks and rules
	HD92	=  1; 	// double hard 9 vs. 2 if TC >= 1 -- for any number
 			// of decks
	HD85 	=  3;	// double hard 8 vs. 5 if TC >= 3; all decks
	HD86	=  1;   // double hard 8 vs. 6 if TC >= 1; all decks

	SDA24  	=  3; 	// double soft 13 vs. 4 if TC >= 3
	SDA34	=  1;	// double soft 14 vs 4 if TC >= 1
	SDA62	=  1;   // double soft 17 vs. 2 if TC >= 1
	SDA86 	=  1;   // double soft 19 vs. 6 if TC >= 1

	SP44	=  1;   // split 4,4 vs. 4 if TC >= 1

	SU169	=  0;  	// Surrender hard 16 vs. 9 if TC >= 0  (all decks)
			// with the exception of 8,8 vs. 9, of course

if  (HC)	// If the dealer checks for blackjack OR additional splits
                // and doubles are refunded (hole card game)
 if  (DECK1)
	HD11A	=  0;   // for 1 deck, double hard 11 vs. Ace if TC >= 0
 else
	HD11A	=  1;	// double hard 11 vs. Ace if TC >= 1
 endif

	HD1110 	= -4;   // double hard 11 vs. 10 if TC >= -4
	HD1010	=  4;   // double hard 10 vs. 10 up if TC >= 4
	HD10A	=  4;	// double hard 10 vs. Ace up if TC >= 4

 if (NOT MDRAW)   	// only one card to split aces
	SPAA    = -3;   // split A,A vs. Ace if TC >= -3
	SPA10	= -8;   // split A,A vs. 10 if TC >= -8
 else
	SPAA	=-99;  	// always split A,A vs. Ace if multiple draw 
			// to split aces is allowed
	SPA10	=-99;  	// always split A,A vs. 10
 endif

else	// no hole card, splits and doubles lost against dealer's blackjack
	HD11A	= 99;	// do not double hard 11 vs. ace up
	HD1110 	=  2;	// double hard 11 vs. 10 up if TC >= 2;
	HD1010	= 99;	// do not double hard 10 vs. 10 up
	HD10A	= 99;	// do not double hard 10 vs. Ace up

	SPA10   = -3;  	// split A,A vs. 10 if TC >= -3 for no hole card game
 if (MDRAW)
	SPA10	=-99;	// always split aces vs. 10 up if multiple draw
 endif
	// SPA10 index for MDRAW & no hole card is not available
 // no doubling or splitting A,A vs. A for no-hole card game comes from BS
endif  

if ( NOT MDRAW)	// only one card to split aces
	SPA9	= -7;	// split A,A vs. 9 if TC >= -7
	SPA8	= -8;	// split A,A vs. 8 if TC >= -8
	SPA7	= -9;	// split A,A vs. 7 if TC >= -9

else 		// multiple draw to split aces is allowed
	SPA9	=-99;	// split A,A vs. 9
	SPA8	=-99;	// split A,A vs. 8
	SPA7	=-99;	// always split A,A vs. 7
endif	


// AND FINALLY THE TABLES

//       2   3   4   5   6   7   8   9  10  Ace     (Dealer's up cards)

//      hard standing table (stand if TC >= number, hit if TC < number)
DEFTBL HHT
       (  3,  2,  0, -1,  0, 99, 99, 99, 99, 99,       // hard 12
          0, -1, -3, -4, -4, 99, 99, 99, 99, 99,       // hard 13
         -3, -4, -6, -7, -7, 99, 99, 99, 99, 99,       // hard 14
         -5, -6, -7, -9, -9, 10, 10,  8,  4, 10,       // hard 15
         -8,-10,-99,-99,-99,  9,  7,  5,  0,  8,       // hard 16
        -99,-99,-99,-99,-99,-99,-99,-99,-99, -6)       // hard 17

//    soft standing table (stand if TC >= number, hit if TC < number)
DEFTBL SHT
       (-99,-99,-99,-99,-99,-99,-99, 99, 99,SH18A) 	// soft 18

//    hard doubling table (double if TC >= number)
DEFTBL HDT
       (  99, 99, 99,   9,   9, 99, 99, 99, 99, 99,     // hard 7
          99,  9,  5,HD85,HD86, 99, 99, 99, 99, 99,     // hard 8
        HD92,  0, -2,  -4,  -6,  3,  7, 99, 99, 99,     // hard 9
          -8, -9,-10, -99, -99, -6, -4, -1,HD1010,HD10A, // hard 10
         -99,-99,-99, -99, -99, -9, -6, -4,HD1110,HD11A) // hard 11

//    hard doubling table for small numbers (double if TC >= number)
DEFTBL SMDT
       (  99, 99, 99,  99,  99, 99, 99, 99, 99, 99 ,    // hard 4
          99, 99, 99,  99,  99, 99, 99, 99, 99, 99 ,    // hard 5
          99, 99, 99,  99,  99, 99, 99, 99, 99, 99 )    // hard 6

//    soft doubling table (double if TC >= number)
//          2    3    4    5     6   7   8      (dealer's up cards)
DEFTBL SDT
       (   99,    7,SDA24,  0,   -1, 99, 99,          	// A2
           99,    7,SDA34, -1,   -4, 99, 99,            // A3
           99,    7,    0, -4,   -9, 99, 99,            // A4
           99,    4,   -2, -6,  -99, 99, 99,            // A5
        SDA62,   -3,   -7,-10,  -99, 99, 99,            // A6
            0,   -2,   -6, -8,  -10, 99, 99,            // A7
            8,    5,    3,  1,SDA86, 99, 99,            // A8
           10,    8,    6,  5,    4, 99, 99,            // A9
           99,   99,   99, 99,   99, 99, 99)            // A10 (soft 21)


// Important note: split indices for 8,8 vs. 10,
// 8,8 vs. 9, and 3,3 vs. 7 are reversal:
// split 8s vs. 10, 8s vs. 9, and 3s vs. 7 if TC <= index

if  (DAS)   // doubling is allowed after splitting
// 	splitting table for DAS (split if TC >= number)
DEFTBL SPT      
        ( -3, -5,  -7, -9,-99,-99,  5, 99, 99, 99,      // splitting 2s
           0, -4,  -7, -9,-99, 99,  4, 99, 99, 99,      // splitting 3s
          99,  6,SP44, -1, -4, 99, 99, 99, 99, 99,      // splitting 4s
          99, 99,  99, 99, 99, 99, 99, 99, 99, 99,      // splitting 5s
          -1, -4, -6, -8,-10,SP67, 99, 99, 99, 99,      // splitting 6s
          -9,-99,-99,-99,-99,-99,SP78, 99, 99, 99,      // splitting 7s
         -99,-99,-99,-99,-99,-99,-99, 99,SP810,SP8A,    // splitting 8s
          -2, -3,  -5, -6, -6,  3, -8, -9, 99,  3,      // splitting 9s
          99,  8,   6,  5,  4, 99, 99, 99, 99, 99,      // splitting 10s
         -99,-99,-99,-99,-99,SPA7,SPA8,SPA9,SPA10,SPAA) // splitting Aces

else       // doubling is NOT allowed after splitting
	// playing indexes are not available, follows basic strategy
// 	splitting table for no DAS (split if TC >= number)
DEFTBL SPT	
        ( 99,SP23,-99,-99,-99,-99, 99, 99, 99, 99,     	// splitting 2s
           99, 99,-99,-99,-99, 99, 99, 99, 99, 99,      // splitting 3s
           99, 99, 99, 99, 99, 99, 99, 99, 99, 99,      // splitting 4s
           99, 99, 99, 99, 99, 99, 99, 99, 99, 99,      // splitting 5s
         SP62,-99,-99,-99,-99, 99, 99, 99, 99, 99,      // splitting 6s
          -99,-99,-99,-99,-99,-99, 99, 99, 99, 99,      // splitting 7s
          -99,-99,-99,-99,-99,-99,-99, 99,SP810,SP8A,      // splitting 8s
          -99,-99,-99,-99,-99, 99,-99,-99, 99, 99,      // splitting 9s
           99, 99, 99, 99, 99, 99, 99, 99, 99, 99,      // splitting 10s
          -99,-99,-99,-99,-99,-99,-99,-99,-99,SPAA)      // splitting Aces

endif      // DAS versus non DAS splitting tables


// Surrendering 7,7 and 8,8 vs 10 handled with SU7710 and SU8810 respectively

//                            7   8   9  10  ace   -- dealer's up cards

//       Late surrender table (surrender if TC >= number)
DEFTBL LST
                            ( 99, 99, 99, 99, 99,     // surrender hard 12
                              99, 99, 99,  8, 99,     // surrender hard 13
                              99, 99,  6,  3,  6,     // surrender hard 14
                              99,  7,  2,  0,  2,     // surrender hard 15
                              99,  4,SU169,-99,-99,   // surrender hard 16
                              99, 99, 99, 99,SU17A)     // surrender hard 17


//  	 Early surrender table (surrender if TC >= number)
DEFTBL EST
                            ( 99, 99, 99, 99, 99,     // surrender hard 4
                              99, 99, 99, 99, 99,     // surrender hard 5
                              99, 99, 99, 99,-99,     // surrender hard 6
                              99, 99, 99, 99,-99,     // surrender hard 7
                              99, 99, 99, 99, 99,     // surrender hard 8
                              99, 99, 99, 99, 99,     // surrender hard 9
                              99, 99, 99, 99, 99,     // surrender hard 10
                              99, 99, 99, 99, 99,     // surrender hard 11
                              99, 99, 99, 99,-99,     // surrender hard 12
                              99, 99, 99, 99,-99,     // surrender hard 13
                              99, 99,  6,-99,-99,     // surrender hard 14
                              99,  7,  2,-99,-99,     // surrender hard 15
                              99,  4,SU169,-99,-99,   // surrender hard 16
                              99, 99, 99, 99,-99,     // surrender hard 17
                              99, 99, 99, 99, 99,     // surrender hard 18
                              99, 99, 99, 99, 99)     // surrender hard 19


//	Early surrender versus 10 table (late surrender versus Ace)
DEFTBL E10ST  
                             (99, 99, 99, 99, 99,     // surrender hard 12
                              99, 99, 99, 99, 99,     // surrender hard 13
                              99, 99,  6,-99,  6,     // surrender hard 14
                              99,  7,  2,-99,  2,     // surrender hard 15
                              99,  4,SU169,-99,-1,   // surrender hard 16
                              99, 99, 99, 99,SU17A)     // surrender hard 17

