home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0950.lha / BBDoors / BBDoors65.lha / rexxDoors / BlackJack.rexx < prev    next >
OS/2 REXX Batch file  |  1993-10-18  |  30KB  |  1,149 lines

  1. /*                     Black Jack Version 2.0
  2.  This game is written specially to run on BBBBS, the BBS software
  3.  package written by Richard Stockton. This game was written by
  4.  Matt English on 5-7-92. You have my premission to use this game
  5.  on your BBS as long as you leave my name in the code as original writer
  6.  and you don't make any cash from this game (in any way).
  7.  This is version 1.0. I have other ideas for this game that I will put in
  8.  future versions (if I get the time). To run the game, just put this file
  9.  in your Rexxdoors directory. Hope you like it.
  10.  
  11.                               6-21-92
  12.  Version 2.0 now includes the ability to play from INSIDE of Chicago 1.3!
  13.  Version 2.0 wil also run fine by itself, without Chicago 1.3, but it's
  14.  more fun that way!*/
  15.  
  16.  
  17. FF='0C'x  /* FormFeed */
  18. CR='0D'x  /* Carraige Return */
  19. CALL TIME('R')
  20. SIGNAL ON BREAK_C
  21. SIGNAL ON BREAK_E
  22.  
  23. PARSE arg Username winnings . colorflag secs .
  24. IF secs='' THEN secs=3600
  25. signal on syntax
  26.  
  27. if ~show('L','rexxsupport.library') then do
  28.   addlib('rexxsupport.library',0,-30,0)
  29.   end
  30.  
  31. i = random(1,999,time('S')) /* initalize random number generator */
  32.  
  33.  
  34. def=''
  35. pen2=''
  36. pen3=''
  37. pen4=''
  38. pen5=''
  39. pen6=''
  40. pen7=''
  41. bak2=''
  42. bak3=''
  43. bak4=''
  44. bak5=''
  45. bak6=''
  46. bak7=''
  47. unln=''
  48. CLS = ''
  49.  
  50. CHICCOLOR = GetClip('CHICCOLOR')
  51.  
  52. IF colorflag=1 | CHICCOLOR = 1 THEN
  53.   DO
  54.     def=''
  55.     pen2=''
  56.     pen3=''
  57.     pen4=''
  58.     pen5=''
  59.     pen6=''
  60.     pen7=''
  61.     bak2=''
  62.     bak3=''
  63.     bak4=''
  64.     bak5=''
  65.     bak6=''
  66.     bak7=''
  67.     unln=''
  68.   END
  69.   CLS = ''
  70.  
  71. /*This checks to see if the game has been called from Chicago 1.3
  72. and makes the proper adjustments.*/
  73.  
  74. chicplay = GetClip('CHICMON')
  75. if chicplay ~='' then do
  76.    avc = chicplay
  77.    chicgame = 1
  78.    secs=360  /* 6 minute limit from Chicago */
  79.    call play
  80.    end
  81.  
  82. /*-----------------MAIN SECTION----------------------*/
  83.  
  84. START:
  85. avc = 500
  86. say ''cls''cr
  87. say ''cr
  88. call header
  89. say ''cr
  90. call sac70'Welcome to BlackJack!'
  91. say ''cr
  92. call sac70'Version 2.0  6-21-92'
  93. say ''cr
  94. call sac70'Written by Matt English'
  95. say ''cr
  96. call sac70'SYSOP - The Alternative BBS - Portland Oregon'
  97. call sac70'503-761-3043'
  98. say ''cr
  99. say ''cr
  100. say ''cr
  101. say ''cr
  102. say ''cr
  103. call pressreturn
  104. say ''cr
  105.  
  106. Play:
  107.     CALL checkBBS()
  108.     cc = 0
  109.     dc = 0
  110.     h1.1='';h1.2='';h1.3='';h1.4='';h1.5='';h1.6='';h1.7='';h1.8='' /* Player hand 1 */
  111.     h2.1='';h2.2='';h2.3='';h2.4='';h2.5='';h2.6='';h2.7='';h2.8=''/* Player hand 2 */
  112.     d.1='';d.2='';d.3='';d.4='';d.5='';d.6='';d.7='';d.8=''       /*Dealer hand */
  113.     say ''cr
  114.     if avc < 1 then do
  115.      call sac70'Your available funds seem to have dropped below the minimum bet!'
  116.      say ''cr
  117.      options prompt'       Would you like to play again? (y,n) >'
  118.      pull answer
  119.       if answer = Y then do
  120.        avc = 500
  121.        say ''cr
  122.        call sac70'OK, let''s try it again!'
  123.        say ''cr
  124.        end
  125.       else call QUIT
  126.      end
  127.   /*  options prompt ' How much would you like to bet? (Q = Quit) >'
  128.     pull choice
  129.     choice = strip(choice)   */
  130.  
  131.    call bet
  132.  
  133.    avc = (avc - abet)
  134.     say ''cr
  135.     say ''cr
  136.     ptot1 = 0    /* Player total card points hand 1 */
  137.     ptot2 = 0    /* Player total card points hand 2 */
  138.     dtot = 0    /* Dealer total card points */
  139.     busted = 0
  140.     busted1 = 0
  141.     busted2 = 0
  142.     dlbusted = 0
  143.     twone = 0
  144.     twone1 = 0
  145.     twone2 = 0
  146.     bj1 = 0
  147.     bj2 = 0
  148.     acecount = 0
  149.     call Play1
  150.  
  151. PLAY1:
  152.  
  153.   say ''cr
  154.   say ''cr
  155.   do i = 1 to 2
  156.     call getcard
  157.     h1.i = RCD
  158.   end
  159.   do i = 1 to 2
  160.     call getcard
  161.     d.i = RCD
  162.   end
  163.   BJ = 0  /* BlackJack if = 1 */
  164.   cc = 2  /* card count */
  165.   dc = 2  /* dealers card count */
  166.   splh = 0    /* This hand is a split hand  if 1 */
  167.   splm = 0   /* display the Split menu  if 1 */
  168.   ddnm = 0   /* Display the DD menu if 1 */
  169.   ddnh = 0    /* This hand is Double Down'ed if 1 */
  170.  
  171.   call play2
  172.  
  173. PLAY2:
  174.   if chicgame ~=1 then call header
  175.   say ''cr
  176.   say ''cr
  177.   say'     Amount bet > $'abet'      Your available cash > $'avc''cr
  178.   say ''cr
  179.  
  180.     say' 'bak6'Your Hand >'def' 'pen6''h1.1' 'h1.2' 'h1.3' 'h1.4' 'h1.5' 'h1.6' 'h1.7' 'h1.8''def''cr
  181.    call CPTOT h1 splh
  182.    say ''cr
  183.    say' 'bak6'Your total >'def' 'pen6''ptot1''def''cr
  184.    say ''cr
  185.  
  186.   say' 'bak2'Dealers Hand >'def''pen2' # 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  187.   say ''cr
  188.   say' 'bak2'Dealers total >'def''pen2' ?'def''cr
  189.   say ''cr
  190.   say ''cr
  191.   if cc = 2 & ptot1 = 21 then call BLACKJACK
  192.   say '             1.Draw a card    (Dealer must stand on 17, hit on 16)'cr
  193.   say '             2.Stand'cr
  194.    if cc = 2 & h1.1 = h1.2 then splm = 1
  195.    else splm = 0
  196.    if splm = 1 then do
  197.    if abet > avc then do
  198.     say '  You don''t have enough cash to Split this hand!'cr
  199.     splm = 0
  200.     end
  201.    else say '             3.Split'cr
  202.    end
  203.   if cc = 2 then call checkdd
  204.   say ''cr
  205.   if chicgame = 1 then quitopt = ''
  206.   else quitopt = '(Q = Quit)'
  207.   options prompt ' Your choice ? 'quitopt' > '
  208.   pull ans
  209.    select
  210.      when ans = 'Q' then do
  211.       if chicgame ~=1 then call QUIT
  212.       else call PLAY2
  213.       end
  214.      when ans = 1 then do
  215.       h1 = 1
  216.       call DRAW h1 splh
  217.       end
  218.      when ans = 2 then do
  219.       h1 = 1
  220.       call STAND h1 splh
  221.       end
  222.      when ans = 3 then do
  223.       select
  224.        when splm = 1 then call SPLIT
  225.        when splm = 0 & ddnm = 1 then call DDOWN
  226.        otherwise call PLAY2
  227.        end
  228.       end
  229.      when ans = 4 then do
  230.       if splm = 1 & ddnm = 1 then call DDOWN
  231.        else call PLAY2
  232.       end
  233.      otherwise call PLAY2
  234.      end
  235.  
  236. /*---------------------ROUTINES-----------------------*/
  237.  
  238. DDOWN:
  239.    say ''cr
  240.    ddbet = abet + abet
  241.    avc = avc - abet
  242.    abet = ddbet
  243.    call sac70'OK, we''ll double your bet to $'ddbet','
  244.    call sac70'and you''ll get one card.'
  245.    say ''cr
  246.    call sac70'Your available cash is now $'avc''
  247.    call delay(50)
  248.    say ''cr
  249.    call getcard
  250.    h1.3 = rcd
  251.    whatcard = h1
  252.    call cptot whatcard splh
  253.    call sac70'You draw your one card and get'
  254.    say ''cr
  255.    select
  256.     when rcd = A then pre = 'an'
  257.     when rcd = 8 then pre = 'an'
  258.     otherwise pre = 'a'
  259.     end
  260.    call sac70''pre' 'h1.3''
  261.    say ''cr
  262.    say'             'bak6'Your cards :'def' 'pen6''h1.1' 'h1.2' 'h1.3''def'   'bak6'Your total :'def' 'pen6''ptot1''def''cr
  263.    say ''cr
  264.    call pressreturn
  265.    say ''cr
  266.    call sac70'Ok, let''s see if the Dealer can beat that!'
  267.    say ''cr
  268.    call dlrturn
  269.  
  270. SPLIT:
  271.  splh = 1 /* This is a split hand */
  272.  say ''cr
  273.  call sac70'OK, let''s split your 'pen6''h1.1''def'''s into two hands.'
  274.  call sac70''def'You''ll be playing for $'abet' on 'pen3'EACH hand!'def''
  275.  avc = avc - abet
  276.  totwager = abet * 2
  277.  say ''cr
  278.  h1done = 0   /* signals when hand 1 is done and move to hand 2 */
  279.  cch1 = 1
  280.  cch2 = 1
  281.  busted1 = 0
  282.  busted2 = 0
  283.  twone1 = 0
  284.  h1winner = 0
  285.  h2winner = 0
  286.  select
  287.  when h1.1 = 'A' then ptot1 = 11
  288.  when h1.1 = 'K' then ptot1 = 10
  289.  when h1.1 = 'Q' then ptot1 = 10
  290.  when h1.1 = 'J' then ptot1 = 10
  291.  otherwise ptot1 = h1.1
  292.  end
  293.  select
  294.  when h1.2 = 'A' then ptot2 = 11
  295.  when h1.2 = 'K' then ptot2 = 10
  296.  when h1.2 = 'Q' then ptot2 = 10
  297.  when h1.2 = 'J' then ptot2 = 10
  298.  otherwise ptot2 = h1.2
  299.  end
  300.  call pressreturn
  301.  say ''cr
  302.  call SPLIT1
  303.  
  304. SPLIT1:
  305.  
  306.  if chicgame ~=1 then call header
  307.  say ''cr
  308.  say'   Amount bet > $'abet' per hand.    Your available cash > $'avc''cr
  309.  say ''cr
  310.  say' 'bak6'Your Hand # 1 >'def' 'pen6''h1.1' 'h1.3' 'h1.4' 'h1.5' 'h1.6' 'h1.7' 'h1.8''def''cr
  311.  say ''cr
  312.  if busted1 = 1 then isitbusted = ''pen3'BUSTED!'def''
  313.  if busted1 = 0 then isitbusted = ''
  314.  say' 'bak6'Your Total # 1 >'def' 'pen6''ptot1'  'isitbusted''cr
  315.  say ''cr
  316.  say' 'bak5'Your Hand # 2 >'def' 'pen5''h1.2' 'h2.2' 'h2.3' 'h2.4' 'h2.5' 'h2.6' 'h2.7' 'h2.8''def''cr
  317.  say ''cr
  318.  say' 'bak5'Your Total # 2 >'def' 'pen5''ptot2''def''cr
  319.  say ''cr
  320.  say' 'bak2'Dealers Hand >'def''pen2' # 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  321.  say ''cr
  322.  if busted1 = 1 then h1done = 1
  323.  if h1done = 0 then hnum = ''pen6'Hand # 1'def''
  324.  if h1done = 1 then hnum = ''pen5'Hand # 2'def''
  325.  say' 'bak2'Dealers total >'def''pen2' ?'def'      'bak4'Currently playing'def' 'hnum''cr
  326.  say ''cr
  327.   say '             1.Draw a card    (Dealer must stand on 17, hit on 16)'cr
  328.   say '             2.Stand'cr
  329.   say ''cr
  330.   if chicgame = 1 then quitopt = ''
  331.   else quitopt = '(Q = Quit)'
  332.   options prompt ' Your choice ? 'quitopt' > '
  333.  
  334.   pull ans
  335.    if h1done = 0 then whatcard = h1
  336.    if h1done = 1 then whatcard = h2
  337.    select
  338.      when ans = 'Q' then do
  339.       if chicgame = 1 then call SPLIT1
  340.       else call QUIT
  341.       end
  342.      when ans = 1 then call DRAW whatcard splh
  343.      when ans = 2 then call STAND whatcard splh
  344.      otherwise call SPLIT1
  345.      end
  346.  
  347. BLACKJACK:
  348.  call delay(175)
  349.  call sac70''bak4'BLACKJACK !'def''
  350.  say ''cr
  351.  call sac70''bak4'BLACKJACK !'def''
  352.  say ''cr
  353.  call sac70''bak4'BLACKJACK !'def''
  354.  say ''cr
  355.  call sac70''bak4'BLACKJACK !'def''
  356.  say ''cr
  357.  call sac70''pen3'You win double your bet!'def''
  358.  say ''cr
  359.  amwon = abet*2
  360.  call sac70'$'amwon''
  361.  avc = amwon + abet  + avc
  362.  amwon = 0
  363.  if chicgame = 1 then call chicquit
  364.  else call PLAY
  365.  
  366.  
  367. STAND:
  368. arg whatcard splh
  369. if whatcard = h1 & splh = 0 then do
  370.   say ''cr
  371.   call sac70'OK, you''ll stand on 'ptot1''
  372.   say ''cr
  373.   call sac70'Now it''s the Dealers turn'
  374.   say''cr
  375.   call delay(75)
  376.   call dlrturn
  377.  end
  378.  
  379. if whatcard = h1 & splh = 1 then do
  380.   say ''cr
  381.   call sac70''def'OK, you''ll stand on 'ptot1''def''
  382.   say ''cr
  383.   call sac70'Now it''s time to play 'pen5'Hand # 2'def''
  384.   say''cr
  385.   call delay(75)
  386.   h1done = 1
  387.   call SPLIT1
  388.  end
  389.  
  390. if whatcard = h2 & splh = 1 then do
  391.   say ''cr
  392.   call sac70'OK, you''ll stand on 'ptot2''
  393.   say ''cr
  394.   call sac70'Now it''s the Dealers turn.'
  395.   say''cr
  396.   call delay(75)
  397.   call dlrturnspl
  398.  end
  399.  
  400. dlrturn:
  401.  say ''cr
  402.   select
  403.    when d.1 = A then pre = 'an'
  404.    when d.1 = 8 then pre = 'an'
  405.    otherwise pre = 'a'
  406.    end
  407.    call sac70'The Dealer turns over his hole card to reveal 'pre' 'd.1''
  408.    say '' cr
  409.    say'             'bak2'The Dealers cards :'def''pen2' 'd.1' 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  410.    call cptot d
  411.    say'             'bak2'The Dealers total :'def''pen2' 'dtot''def'   'bak6'Your total'def' 'pen6''ptot1''def''cr
  412.    say ''cr
  413.    call pressreturn
  414.    if dtot < 22 & dtot > ptot1 & dtot > 16 then call loser
  415.    if dtot < 17 then do
  416.     do until dtot > 16
  417.      call getcard
  418.      if dc = 2 then d.3 = RCD
  419.      if dc = 3 then d.4 = RCD
  420.      if dc = 4 then d.5 = RCD
  421.      if dc = 5 then d.6 = RCD
  422.      dc = dc +1
  423.      say ''cr
  424.      select
  425.       when rcd = A then pre = 'an'
  426.       when rcd = 8 then pre = 'an'
  427.       otherwise pre = 'a'
  428.       end
  429.      call sac70'The Dealer draws 'pre' 'rcd''
  430.      say ''cr
  431.      say'             'bak2'The Dealers cards :'def''pen2' 'd.1' 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  432.      call cptot d
  433.      say'             'bak2'The Dealers total :'def''pen2' 'dtot''def'   'bak6'Your total:'def' 'pen6''ptot1''def''cr
  434.      say ''cr
  435.       call pressreturn
  436.      if dtot > 21 then do
  437.       say ''cr
  438.        say'                        The Dealer has 'pen3'BUSTED !'def''cr
  439.       say ''cr
  440.       call winner
  441.      end
  442.     end
  443.    end
  444.    if dtot < ptot1 then call winner
  445.    if dtot = ptot1 then call push
  446.    if dtot < 22 & dtot > ptot1 & dtot > 16 then call loser
  447.  
  448. DLRTURNSPL:
  449.  say ''cr
  450.   select
  451.    when d.1 = A then pre = 'an'
  452.    when d.1 = 8 then pre = 'an'
  453.    otherwise pre = 'a'
  454.    end
  455.    call sac70'The Dealer turns over his hole card to reveal 'pre' 'd.1''
  456.    say '' cr
  457.    say'             'bak2'The Dealers cards :'def''pen2' 'd.1' 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  458.    call cptot d
  459.    say'             'bak2'The Dealers total :'def''pen2' 'dtot''def''cr
  460.    say''cr
  461.    say'             'bak6'Your total Hand # 1 :'def' 'pen6''ptot1'   'bak5'Your total Hand # 2 :'def' 'pen5''ptot2''def''cr
  462.    say ''cr
  463.    call pressreturn
  464.    if dtot < 22 & dtot >  16 then call CALCSPL
  465.    if dtot < 17 then do
  466.     do until dtot > 16
  467.      call getcard
  468.      if dc = 2 then d.3 = RCD
  469.      if dc = 3 then d.4 = RCD
  470.      if dc = 4 then d.5 = RCD
  471.      if dc = 5 then d.6 = RCD
  472.      if dc = 6 then d.7 = RCD
  473.      if dc = 7 then d.8 = RCD
  474.      dc = dc +1
  475.      say ''cr
  476.      select
  477.       when rcd = A then pre = 'an'
  478.       when rcd = 8 then pre = 'an'
  479.       otherwise pre = 'a'
  480.       end
  481.      call sac70'The Dealer draws 'pre' 'rcd''
  482.      say ''cr
  483.      say'             'bak2'The Dealers cards :'def''pen2' 'd.1' 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  484.      call cptot d
  485.      say'             'bak2'The Dealers total :'def''pen2' 'dtot''def''cr
  486.    say''cr
  487.      say'             'bak6'Your total Hand # 1 :'def' 'pen6''ptot1' 'pen3''isitbusted'   'bak5'Your total Hand # 2 :'def' 'pen5''ptot2''def''cr
  488.      say ''cr
  489.      call pressreturn
  490.      if dtot > 21 then do
  491.       dlbusted = 1
  492.       say ''cr
  493.       say'                          The Dealer has 'pen3'BUSTED!'def''cr
  494.       say ''cr
  495.       call calcspl
  496.      end
  497.     end
  498.    end
  499.    call calcspl
  500.  
  501. CALCSPL:  /* Calculate split wins. */
  502.     if dlbusted = 1 then do
  503.      if bj1 = 0 then do
  504.       if busted1 = 0 then do
  505.        say'                        'pen6'Your Hand # 1 is a winner!'def''cr
  506.        say'                            'pen6'Hand # 1 pays $'abet''def''cr
  507.        say ''cr
  508.        avc = abet + abet + avc
  509.        end
  510.       else do
  511.        say'                        'pen6'Your Hand # 1 is 'pen3'BUSTED.'def''cr
  512.        say'                           'pen6'Hand # 1 'pen3'loses 'pen6'$'abet''def''cr
  513.        say ''cr
  514.        end
  515.       end
  516.      else do
  517.         say'                       'pen6'Your Hand # 1 is a 'def''bak6'BLACKJACK!'def''cr
  518.         say'                           'pen6'Hand # 1 pays 'def''bak6'2 'def''pen6'times your bet!'def''cr
  519.         bjwin = abet * 2
  520.         call sac70'$'bjwin''
  521.         avc = avc + abet + bjwin
  522.         bjwin = 0
  523.         say ''cr
  524.         end
  525.  
  526.      if bj2 = 0 then do
  527.       if busted2 = 0 then do
  528.        say'                        'pen5'Your Hand # 2 is a 'def''bak5'winner!'def''cr
  529.        say'                            'pen5'Hand # 2 pays 'def''bak5'$'abet''def''cr
  530.        say ''cr
  531.        avc = abet + abet + avc
  532.        end
  533.       else do
  534.        say'                        'def''pen5'Your Hand # 2 is 'pen3'BUSTED.'def''cr
  535.        say'                                'pen5'Hand # 2 'pen3'loses 'pen5'$'abet''def''cr
  536.        say ''cr
  537.        end
  538.       end
  539.      else do
  540.        say'                        'pen5'Your Hand # 2 is a 'def''bak5'BLACKJACK!'def''def''cr
  541.        say'                            'pen5'Hand # 2 pays 'def''bak5'2 'def''pen5'times your bet!'def''cr
  542.         bjwin = abet * 2
  543.         call sac70'$'bjwin''
  544.         avc = avc + abet + bjwin
  545.         bjwin = 0
  546.         say ''cr
  547.         end
  548.        if chicgame = 1 then call chicquit
  549.        else call play
  550.       end
  551.     if dtot > ptot1 & dlbusted = 0 then do
  552.        say'                        'pen6'Your Hand # 1 is a 'pen3'loser!'def''cr
  553.        say'                            'pen6'Hand # 1 'pen3'loses 'pen6'$'abet''def''cr
  554.      say ''cr
  555.     end
  556.     if dtot < ptot1 & busted1 = 0 & bj1 = 0 then do
  557.        say'                        'pen6'Your Hand # 1 is a winner!'def''cr
  558.        say'                            'pen6'Hand # 1 wins $'abet''def''cr
  559.      say ''cr
  560.      avc = avc + (abet * 2)
  561.     end
  562.     if bj1 = 1 then do
  563.        say'                        'pen6'Your Hand # 1 is a 'def''bak4'BLACKJACK!'def''cr
  564.        say'                            'pen6'Hand # 1 wins 2 times your bet!'def''cr
  565.      bjwin = abet * 2
  566.      call sac70'$'bjwin''
  567.      say ''cr
  568.      avc = avc + abet + bjwin
  569.      bj1 = 0
  570.      bjwin = 0
  571.      end
  572.     if dtot = ptot1 & busted1 = 0 then do /* Means this is a push. */
  573.        say'                    Your Hand # 1 is a push!'cr
  574.        say'              Your bet will be returned for Hand # 1.'cr
  575.      say ''cr
  576.      avc = avc + abet
  577.     end
  578.     if busted1 = 1 then do
  579.        say'                        'pen6'Your Hand # 1 is 'pen3'BUSTED!'def''cr
  580.        say'                            'pen6'Hand # 1 'pen3'loses $'abet'!'def''cr
  581.      say ''cr
  582.      end
  583.     if dtot > ptot2 & dlbusted = 0 then do
  584.        say'                        'pen5'Your Hand # 2 is a 'pen3'loser!'def''cr
  585.        say'                            'pen5'Hand # 2 loses 'pen3'$'abet''def''cr
  586.      say ''cr
  587.     end
  588.     if dtot < ptot2 & busted2 = 0 then do
  589.        say'                        'pen5'Your Hand # 2 is a winner!'def''cr
  590.        say'                            'pen5'Hand # 2 wins $'abet''def''cr
  591.      say ''cr
  592.      avc = avc + (abet * 2)
  593.     end
  594.     if bj2 = 1 then do
  595.        say'                        'pen5'Your Hand # 2 is a 'def''bak2'BLACKJACK!'def''cr
  596.        say'                            'pen5'Hand # 2 wins 2 times your bet!'def''cr
  597.      bjwin = abet * 2
  598.      call sac70'$'bjwin''
  599.      say ''cr
  600.      avc = avc + abet + bjwin
  601.      bj2 = 0
  602.      bjwin = 0
  603.      end
  604.     if dtot = ptot2 then do /* Means this is a push */
  605.        say'                         'pen5'Your Hand # 2 is a push!'def''cr
  606.        say'                 'pen5'Your bet will be returned for Hand # 2.'def''cr
  607.      say ''cr
  608.      avc = avc + abet
  609.     end
  610.     if busted2 = 1 then do
  611.        say'                        'pen5'Your Hand # 2 is 'pen3'BUSTED!'def''cr
  612.        say'                           'pen5'Hand # 2 'pen3'loses $'abet'!'def''cr
  613.      say ''cr
  614.      end
  615.  
  616. if chicgame = 1 then call chicquit
  617. else call play
  618.  
  619. WINNER:
  620.  say ''cr
  621.  say'                   'bak2'Congratulations, you win this hand!'def''cr
  622.  
  623.    avc = (abet * 2) + avc
  624.    say ''cr
  625.    say'                          'pen2'You have just won $'abet'!'def''cr
  626.    say''cr
  627.    say ''cr
  628.  if chicgame = 1 then call chicquit
  629.  else call PLAY
  630.  
  631. LOSER:
  632.  say ''cr
  633.  say'                        'bak3'Bummer!'def''pen3' You lose this hand.'def''cr
  634.  say ''cr
  635.  say'                             'def''pen3'You just lost $'abet'!'def''def''cr
  636.  if chicgame = 1 then call chicquit
  637.  else call PLAY
  638.  
  639. PUSH:
  640.  say ''cr
  641.  call sac70'You and the Dealer tie!'
  642.  say ''cr
  643.  call sac70'You don''t win, you don''t lose.'
  644.  say ''cr
  645.  call sac70'Your bet is returned!'
  646.  avc = abet + avc
  647.  if chicgame = 1 then call chicquit
  648.  else call PLAY
  649.  
  650.  
  651. DRAW:
  652. arg whatcard splh
  653. call getcard
  654. if whatcard = h1 & splh = 0 then do
  655.   if cc = 2 then h1.3 = rcd
  656.   if cc = 3 then h1.4 = rcd
  657.   if cc = 4 then h1.5 = rcd
  658.   if cc = 5 then h1.6 = rcd
  659.   if cc = 6 then h1.7 = rcd
  660.   if cc = 7 then h1.8 = rcd
  661.   cc = cc + 1
  662.   say ''cr
  663.   call sac70'You draw a card and get'
  664.   call delay(100)
  665.   say ''cr
  666.     select
  667.    when rcd = A then pre = 'an'
  668.    when rcd = 8 then pre = 'an'
  669.    otherwise pre = 'a'
  670.    end
  671.   call sac70''pre' 'rcd''
  672.   say ''cr
  673.   call delay(100)
  674. call cptot h1 splh
  675. call chk21 h1 splh
  676. if twone = 1 then call dlrturn  /* if total is 21 Dealers turn */
  677. call chkbust h1 splh
  678. if busted = 1 then do
  679.  if chicgame = 1 then call chicquit
  680.  else call Play
  681.  end
  682. call play2
  683. end
  684.  
  685.  
  686. if whatcard = h1 & splh = 1 then do
  687.   if cch1 = 1 then h1.3 = rcd
  688.   if cch1 = 2 then h1.4 = rcd
  689.   if cch1 = 3 then h1.5 = rcd
  690.   if cch1 = 4 then h1.6 = rcd
  691.   if cch1 = 5 then h1.7 = rcd
  692.   if cch1 = 6 then h1.8 = rcd
  693.   cch1 = cch1 + 1
  694.   say ''cr
  695.   call sac70'You draw a card and get'
  696.   call delay(100)
  697.   say ''cr
  698.   select
  699.    when rcd = A then pre = 'an'
  700.    when rcd = 8 then pre = 'an'
  701.    otherwise pre = 'a'
  702.    end
  703.   call sac70''pre' 'rcd''
  704.   say ''cr
  705.   call delay(100)
  706. call cptot h1 splh
  707. call chk21 h1 splh
  708. if twone1 = 1 then do
  709.  h1done = 1
  710.  call SPLIT1
  711.  end
  712. call chkbust h1 splh
  713. if busted1 = 1 then do
  714.  h1done = 1
  715.  call SPLIT1
  716.  end
  717. call split1
  718. end
  719.  
  720. if whatcard = h2 & splh = 1 then do
  721.   if cch2 = 1 then h2.2 = rcd
  722.   if cch2 = 2 then h2.3 = rcd
  723.   if cch2 = 3 then h2.4 = rcd
  724.   if cch2 = 4 then h2.5 = rcd
  725.   if cch2 = 5 then h2.6 = rcd
  726.   if cch2 = 6 then h2.7 = rcd
  727.   cch2 = cch2 + 1
  728.   say ''cr
  729.   call sac70'You draw a card and get'
  730.   call delay(100)
  731.   say ''cr
  732.   select
  733.    when rcd = A then pre = 'an'
  734.    when rcd = 8 then pre = 'an'
  735.    otherwise pre = 'a'
  736.    end
  737.   call sac70''pre' 'rcd''
  738.   say ''cr
  739.   call delay(100)
  740. call cptot h2 splh
  741. call chk21 h2 splh
  742. if twone2 = 1 then do
  743.  call dlrturnspl
  744.  end
  745. call chkbust h2 splh
  746. if busted2 = 1 then do
  747.  if busted1 = 1 then do
  748.   say ''cr
  749.   call sac70'Both of your Hands are 'pen3'Busted!'def''
  750.   call sac70'You lose your entire wager, 'pen3'$'totwager'!'def''
  751.   if chicgame = 1 then call chicquit
  752.   else call PLAY
  753.   end
  754.  else call dlrturnspl
  755.  end
  756. call split1
  757. end
  758.  
  759.  
  760. chkbust:
  761. arg whatcard splh
  762. select
  763.   when whatcard = h1 & splh = 0 then do
  764.    if ptot1 > 21 then do
  765.     say ''cr
  766.     say'                              Your total is 'ptot1''cr
  767.     say ''cr
  768.     say'                                  'pen3'BUSTED!'def''cr
  769.     say ''cr
  770.     say'                              You just lost 'pen3'$'abet''def''cr
  771.     busted = 1
  772.     say ''cr
  773.     call pressreturn
  774.     say ''cr
  775.    end
  776.   end
  777.  
  778. when whatcard = h1 & splh = 1 then do
  779.    if ptot1 > 21 then do
  780.     say ''cr
  781.     say'                                 Your total is 'ptot1''cr
  782.     say ''cr
  783.     say'                                   'pen3'BUSTED!'def''cr
  784.     busted1 = 1
  785.     say ''cr
  786.     call sac70'Now let''s play Hand # 2'
  787.     say ''cr
  788.     call pressreturn
  789.     say ''cr
  790.    end
  791.   end
  792.  
  793.   when whatcard = h2 & splh = 1 then do
  794.    if ptot2 > 21 then do
  795.     say ''cr
  796.     say'                                 Your total is 'ptot2''cr
  797.     say ''cr
  798.     say'                                   'pen3'BUSTED!'def''cr
  799.     busted2 = 1
  800.     say ''cr
  801.     call pressreturn
  802.     say ''cr
  803.    end
  804.   end
  805. END
  806. return
  807.  
  808.  
  809. chk21:
  810. arg whatcard splh
  811.   if whatcard = h1 & splh = 0 then do
  812.    if ptot1 = 21 then do
  813.     say ''cr
  814.     call sac70'Your total is 21!'
  815.     say ''cr
  816.     call sac70'Now it''s the Dealers turn.'
  817.     twone = 1
  818.    end
  819.   end
  820.  
  821.   if whatcard = h1 & splh = 1 then do
  822.    if ptot1 = 21 then do
  823.     say ''cr
  824.     call sac70'Your total is 21!'
  825.     say ''cr
  826.     call sac70'Now let''s play Hand # 2.'
  827.     call delay(75)
  828.     twone1 = 1
  829.    end
  830.   end
  831.  
  832.   if whatcard = h2 & splh = 1 then do
  833.    if ptot2 = 21 then do
  834.     say ''cr
  835.     call sac70'Your total is 21!'
  836.     say ''cr
  837.     call sac70'Now let''s see what kinda luck the Dealer has.'
  838.     twone2 = 1
  839.    end
  840.   end
  841.  
  842. return
  843.  
  844. CHECKDD:
  845.  
  846.    if h1.1 = '10' then Return
  847.    if h1.1 = 'J' then Return
  848.    if h1.1 = 'Q' then Return
  849.    if h1.1 = 'K' then Return
  850.    if h1.1 = 'A' then Return
  851.  
  852.    if h1.2 = '10' then Return
  853.    if h1.2 = 'J' then Return
  854.    if h1.2 = 'Q' then Return
  855.    if h1.2 = 'K' then Return
  856.    if h1.2 = 'A' then Return
  857.  
  858.    if cc = 2 & h1.1 + h1.2 > 9 & h1.1 + h1.2 < 12 then do
  859.     if abet > avc then do
  860.      say '    You don''t have enough cash to Double Down.'cr
  861.      return
  862.      end
  863.     if splm = 1 then say '             4.Double Down'cr
  864.     else say '             3.Double Down'cr
  865.     ddnm = 1  /* This says display Double Down menu */
  866.    end
  867.  
  868. Return
  869.  
  870. CPTOT:
  871.  
  872. arg whatcard splh
  873. acecount = 0
  874.   if whatcard = h1 & splh = 0 then do
  875.      do i = 1 to 8
  876.       if h1.i = '' then t.i = 0
  877.       if h1.i = 'J' then t.i = 10
  878.       if h1.i = 'Q' then t.i = 10
  879.       if h1.i = 'K' then t.i = 10
  880.       if h1.i = 'A' then do
  881.        acecount = acecount + 1
  882.        t.i = 0
  883.        end
  884.       if h1.i > 1 & h1.i < 11 then t.i = h1.i
  885.       end
  886.       tptot = t.1 + t.2 + t.3 + t.4 + t.5 + t.6 + t.7 + t.8   /* temp point total*/
  887.       if acecount = 1 then do
  888.        if tptot < 11 then tptot = tptot + 11
  889.        else tptot = tptot + 1
  890.        end
  891.       if acecount = 2 then do
  892.        if tptot < 10 then tptot = tptot + 12
  893.        else tptot = tptot + 2
  894.        end
  895.       if acecount = 3 then do
  896.        if tptot < 9 then tptot = tptot + 13
  897.        else tptot = tptot + 3
  898.        end
  899.       if acecount = 4 then do
  900.        if tptot < 8 then tptot = tptot + 14
  901.        else tptot = tptot + 4
  902.        end
  903.       ptot1 = tptot
  904.       acecount = 0
  905.       tptot = 0
  906.      end
  907.   if whatcard = d then do
  908.      do i = 1 to 8
  909.       if d.i = '' then t.i = 0
  910.       if d.i = 'J' then t.i = 10
  911.       if d.i = 'Q' then t.i = 10
  912.       if d.i = 'K' then t.i = 10
  913.       if d.i = 'A' then do
  914.        acecount = acecount + 1
  915.        t.i = 0
  916.        end
  917.       if d.i > 1 & d.i < 11 then t.i = d.i
  918.       end
  919.       tptot = t.1 + t.2 + t.3 + t.4 + t.5 + t.6 + t.7 + t.8   /* temp point total*/
  920.       if acecount = 1 then do
  921.        if tptot < 11 then tptot = tptot + 11
  922.        else tptot = tptot + 1
  923.        end
  924.       if acecount = 2 then do
  925.        if tptot < 10 then tptot = tptot + 12
  926.        else tptot = tptot + 2
  927.        end
  928.       if acecount = 3 then do
  929.        if tptot < 9 then tptot = tptot + 13
  930.        else tptot = tptot + 3
  931.        end
  932.       if acecount = 4 then do
  933.        if tptot < 8 then tptot = tptot + 14
  934.        else tptot = tptot + 4
  935.        end
  936.       dtot = tptot
  937.       acecount = 0
  938.       tptot = 0
  939.      end
  940.  
  941.   if whatcard = h1 & splh = 1 then do
  942.      do i = 1 to 8
  943.       if h1.i = '' then t.i = 0
  944.       if h1.i = 'J' then t.i = 10
  945.       if h1.i = 'Q' then t.i = 10
  946.       if h1.i = 'K' then t.i = 10
  947.       if h1.i = 'A' then do
  948.        acecount = acecount + 1
  949.        t.i = 0
  950.        end
  951.       if h1.i > 1 & h1.i < 11 then t.i = h1.i
  952.       end
  953.       tptot = t.1 + t.3 + t.4 + t.5 + t.6 + t.7 + t.8   /* temp point total*/
  954.       if h1.2 = 'A' then acecount = acecount - 1
  955.       if acecount = 1 then do
  956.        if tptot < 11 then tptot = tptot + 11
  957.        else tptot = tptot + 1
  958.        end
  959.       if acecount = 2 then do
  960.        if tptot < 10 then tptot = tptot + 12
  961.        else tptot = tptot + 2
  962.        end
  963.       if acecount = 3 then do
  964.        if tptot < 9 then tptot = tptot + 13
  965.        else tptot = tptot + 3
  966.        end
  967.       if acecount = 4 then do
  968.        if tptot < 8 then tptot = tptot + 14
  969.        else tptot = tptot + 4
  970.        end
  971.       ptot1 = tptot
  972.       acecount = 0
  973.       tptot = 0
  974.      end
  975.  
  976.   if whatcard = h2 & splh = 1 then do
  977.      do i = 1 to 8
  978.       if h2.i = '' then t.i = 0
  979.       if h2.i = 'J' then t.i = 10
  980.       if h2.i = 'Q' then t.i = 10
  981.       if h2.i = 'K' then t.i = 10
  982.       if h2.i = 'A' then do
  983.        acecount = acecount + 1
  984.        t.i = 0
  985.        end
  986.       if h2.i > 1 & h2.i < 11 then t.i = h2.i
  987.       end
  988.       tptot = t.2 + t.3 + t.4 + t.5 + t.6 + t.7 + t.8   /* temp point total*/
  989.       if h1.2 > 1 & h1.2 < 11 then tptot = tptot + h1.2
  990.       if h1.2 = 'J' then tptot = tptot + 10
  991.       if h1.2 = 'Q' then tptot = tptot + 10
  992.       if h1.2 = 'K' then tptot = tptot + 10
  993.       if h1.2 = 'A' then do
  994.        if tptot < 11 then tptot = tptot + 11
  995.        else tptot = tptot + 1
  996.        end
  997.       if acecount = 1 then do
  998.        if tptot < 11 then tptot = tptot + 11
  999.        else tptot = tptot + 1
  1000.        end
  1001.       if acecount = 2 then do
  1002.        if tptot < 10 then tptot = tptot + 12
  1003.        else tptot = tptot + 2
  1004.        end
  1005.       if acecount = 3 then do
  1006.        if tptot < 9 then tptot = tptot + 13
  1007.        else tptot = tptot + 3
  1008.        end
  1009.       if acecount = 4 then do
  1010.        if tptot < 8 then tptot = tptot + 14
  1011.        else tptot = tptot + 4
  1012.        end
  1013.       ptot2 = tptot
  1014.       acecount = 0
  1015.       tptot = 0
  1016.      end
  1017.  
  1018. Return
  1019.  
  1020. getcard:
  1021.    RND = RANDOM(1,13)
  1022.     if RND > 1 & RND < 11 then do
  1023.       RCD = RND
  1024.       end
  1025.     if RND = 1 then RCD = 'A'
  1026.     if RND = 11 then RCD = 'J'
  1027.     if RND = 12 then RCD = 'Q'
  1028.     if RND = 13 then RCD = 'K'
  1029. Return
  1030.  
  1031.  
  1032. bet:
  1033.    say ''cr
  1034.    say ''cr
  1035.    say ' You have $'avc' available'cr
  1036.    say ''cr
  1037.    options prompt '  How much would you like to bet? 'pen3'$500 max. 'def'(Q = Quit) > $'
  1038.    pull abet
  1039.    abet = strip(abet)
  1040.    if abet = 'Q' then do
  1041.     if chicgame = 1 then do
  1042.      say ''cr
  1043.      say'  Sorry Bud, you can''t sit down and then refuse to bet!'cr
  1044.      say'  Now bet something! Or should I get some muscle over here?'cr
  1045.      say ''cr
  1046.      say ''cr
  1047.      call bet
  1048.      end
  1049.     else call quit
  1050.    end
  1051.    if abet = ''| abet = 0 then do
  1052.     say''cr
  1053.     say'    OK Buddy, if your not going to bet,'cr
  1054.     say'    we''re going to have to ask you to'cr
  1055.     say'    leave so we can seat another player!'cr
  1056.     call bet
  1057.    end
  1058.    if datatype(abet,W) ~= 1 then do
  1059.     say ''cr
  1060.     say '   The Dealer glares at you and says'cr
  1061.     say '   "We have rules at this table Buddy!'cr
  1062.     say '   You can only bet 'pen3'WHOLE'def' dollars'cr
  1063.     say '   and Your ABC''s aren''t worth anything here!"'cr
  1064.     say ''cr
  1065.     abet = ''
  1066.     call BET
  1067.     end
  1068.    if abet > 500 then do
  1069.     say ''cr
  1070.     say' Sorry pal, there''s a $500 limit at this table!'cr
  1071.     say' How ''bout betting a little less...'cr
  1072.     abet = ''
  1073.     call bet
  1074.     end
  1075.    if abet > avc then do
  1076.      say' Sorry, You can''t bet more than you have!'cr
  1077.      say' We do not extend credit at this establishment!'cr
  1078.      say' Please try again.'cr
  1079.      abet = ''
  1080.      call BET
  1081.      end
  1082.  
  1083.  
  1084.    if abet = '' then call bet
  1085.    say ''cr
  1086.    call delay(25)
  1087. Return
  1088.  
  1089. QUIT:
  1090.   say ''cr
  1091.   say'  Thanks for playing BlackJack! Come back soon!'cr
  1092.   say'  Returning now to the BBS.....'cr
  1093.   exit
  1094.  
  1095. chicquit:
  1096.   call setclip('CHICMON',avc)
  1097.   say ''cr
  1098.   say ''cr
  1099.   say' Thanks for trying BlackJack, come back any time (that ya got cash).'cr
  1100.   say ''cr
  1101.   exit
  1102.  
  1103. SAC70:  /* SAY CENTER TEXT*/
  1104. PARSE ARG string
  1105. SAY CENTER(string,75)||CR
  1106. RETURN
  1107.  
  1108. SAC110:  /* SAY CENTER TEXT*/
  1109. PARSE ARG string
  1110. SAY CENTER(string,110)||CR
  1111. RETURN
  1112.  
  1113. HEADER:
  1114. say'          'pen3'----------------------------------------------------------'cr
  1115. say'          'pen3'| 'pen5'BlackJack'pen6'BlackJack'pen5'BlackJack'pen6'BlackJack'pen5'BlackJack'pen6'BlackJack 'pen3'|'cr
  1116. say'          'pen3'| 'pen6'Jack'pen5'BlackJack'pen6'BlackJack'pen5'BlackJack'pen6'BlackJack'pen5'BlackJack'pen6'Black 'pen3'|'cr
  1117. say'          'pen3'----------------------------------------------------------'def''cr
  1118. return
  1119.  
  1120. pressreturn:
  1121. options prompt' 'pen3' Press return to continue'def''
  1122. pull response
  1123. return
  1124.  
  1125.  
  1126. SYNTAX:
  1127.    SAY '*BOOM*  Got a syntax error.  PLEASE notify the sysop.'
  1128.    SAY 'Line:' SIGL '   Error Code:' RC
  1129. exit
  1130.  
  1131.  
  1132. checkBBS:
  1133. IF ADDRESS()~='BAUD' THEN RETURN 0
  1134. IF TIME('e')>secs THEN SIGNAL QUIT
  1135. dcd
  1136. IF RC=0 THEN EXIT
  1137. temp=secs-TIME('E')
  1138. IF temp<120 THEN SAY '*** Only' temp 'seconds left! ***'CR 
  1139. RETURN 0
  1140.  
  1141.  
  1142. BREAK_C:
  1143. BREAK_E:
  1144. say'BREAK * BREAK * BREAK *'cr
  1145. say''cr
  1146. if chicgame = 1 then call chicquit
  1147. call quit
  1148. exit
  1149.