home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / amigalibdisks / disk950 / 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