home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 341.img / TCS161S.ZIP / GAMBLE.PAS < prev    next >
Pascal/Delphi Source File  |  1989-09-25  |  24KB  |  808 lines

  1. {$R-,S-,I-,D-,F+,V-,B-,N-,O+,E+ }
  2. {$M 65500,0,0 }
  3.  
  4. unit gamble;
  5.  
  6. interface
  7.  
  8. uses crt,dos,overlay,
  9.      gentypes,configrt,modem,statret,gensubs,subs1,subs2;
  10.  
  11.  
  12. const
  13.                                         {Definitions of Constants}
  14.        perinc     :real=10;             {Percent of Increase in RR}
  15. var
  16.    Credits      :integer;
  17.    yn           :string;
  18.    randcha2     :byte;
  19.    randchar     :byte;
  20.    intcred      :byte;
  21.    bet          :word;
  22.    command1     :word;
  23.    curthrow     :byte;
  24.    pig          :integer;
  25.    pgir         :integer;
  26.    win          :boolean;
  27.    black        :boolean;
  28.    red          :boolean;
  29.    one          :boolean;
  30.    loop         :byte;
  31.    casechar     :char;
  32. {  var numbers  :ARRAY[0..30] of byte;  Not yet implemented
  33.    var inputnu  :ARRAY[0..8] of byte;
  34.  }
  35. procedure game;
  36.  
  37. implementation
  38.  
  39. procedure game;
  40.  
  41. {Procedures for procedural usage -- GLOBAL}
  42.  
  43. Function capfir(inString:STRING):STRING;
  44.  begin
  45.    capfir:=upcase(inString[1]);
  46.  end;
  47.  
  48. Procedure InitVar;
  49.  begin
  50.    yn:='';
  51.    randcha2:=0;
  52.    randchar:=0;
  53.    intcred:=0;
  54.    bet:=0;
  55.    command1:=0;
  56.    curthrow:=0;
  57.    pig:=0;
  58.    pgir:=0;
  59.    win:=false;
  60.    black:=false;
  61.    red:=false;
  62.    one:=false;
  63.    loop:=0;
  64.  end;
  65.  
  66. Procedure lame;
  67.  begin
  68.   WriteLn(^R'The programmers of TCS are not lame idiots like yourself.');
  69.  end;
  70.  
  71. Procedure exitconvert;
  72.  begin
  73.   WriteLn(^R'Your '^P'['^S,credits,^P']'^R' credits have been converted into '+
  74.    ^P'['^S,trunc(credits/convrate),^P']'^R' file points.');
  75.   urec.udpoints:=trunc(urec.udpoints+(credits/convrate));
  76.   credits:=0
  77.  end;
  78.  
  79.   procedure wingame;
  80.   begin
  81.        writeln;
  82.        for loop:=8 to 15 do begin
  83.          if ansi then ansicolor (loop);
  84.          write ('*');
  85.        end;
  86.        write ('* YOU WIN *');
  87.        for loop:=8 to 15 do begin
  88.          if ansi then ansicolor (loop);
  89.          write ('*');
  90.        end;
  91.        writeln;
  92.        if one then command1:=command1*38;
  93.        writeln (^R'You won '^P'['^S,command1,^P']'^R' credits.');
  94.        credits:=credits+command1;
  95.        writeln ('You now have '^P'['^S,credits,^P']'^R' credits.');
  96.   end;
  97.  
  98.  
  99. {Procedures for games -- CHILD}
  100. {Procedure Keno;
  101. Procedure getvalues;
  102. begin;
  103.   repeat
  104.    randchar:=random(80)+1;
  105.     for pgir:=1 to pig do
  106.    begin
  107.     if randchar=numbers[pgir] then
  108.      begin
  109.      if pgir=pig then black:=true;
  110.      end;
  111.     if black=true then
  112.      begin
  113.       pig:=pig+1;
  114.       numbers[pig]:=randchar;
  115.       black:=false;
  116.      end;
  117.    end;
  118.   until pig=30 or hungupon;
  119. initvar;
  120. end;
  121.  
  122.  
  123. Procedure compare;
  124. begin
  125. repeat
  126.   for pgir:=1 to pig do
  127.  begin
  128.     if numbers[pgir]=inputnu[pig] then intcred:=intcred+1;
  129.     if pgir=pig then pig:=pig+1;
  130.  end;
  131. until pig=8 or hungupon
  132. end;
  133.  
  134. Procedure inputvalues;
  135. begin
  136.  for pgir:=1 to 8 do
  137.  begin
  138.   WriteStr(^P'['^S+strr(pgir)+^P']'^R' What number would you like punched: *');
  139.   inputnu[pgir]:=valu(input);
  140.   if (valu(input)<1) or (valu(input)>80) then pgir:=pgir-1;
  141.   for curthrow:=1 to pgir do
  142.    begin
  143.     if numbers[pgir]=curthrow then
  144.      begin
  145.       pgir:=pgir-1;
  146.       WriteLn('Value '^P'['^S,numbers[pgir],^P']'^R' has already been punched.');
  147.      end;
  148.    end;
  149.  end;
  150. end;
  151.  
  152.          All of this has been "Commented" out for the time being.
  153.  
  154. begin
  155. getvalues;
  156. inputvalues;
  157. compare;
  158. writeln(intcred);
  159. end;}
  160.  
  161.  
  162. Procedure Craps;
  163.   procedure rolldice;
  164.   begin
  165.      randchar:=random(6)+1;
  166.      randcha2:=random(6)+1;
  167.      pig:=randchar+randcha2;
  168.      if ascii then case randchar of
  169.        1:begin
  170.           writeln (^R'╔═══════╗');
  171.           writeln ('║       ║');
  172.           writeln ('║   '^S'o'^R'   ║');
  173.           writeln ('║       ║');
  174.           writeln ('╚═══════╝');
  175.          end;
  176.        2:begin
  177.           writeln (^R'╔═══════╗');
  178.           writeln ('║ '^S'o'^R'     ║');
  179.           writeln ('║       ║');
  180.           writeln ('║     '^S'o'^R' ║');
  181.           writeln ('╚═══════╝');
  182.          end;
  183.        3:begin
  184.           writeln (^R'╔═══════╗');
  185.           writeln ('║ '^S'o'^R'     ║');
  186.           writeln ('║   '^S'o'^R'   ║');
  187.           writeln ('║     '^S'o'^R' ║');
  188.           writeln ('╚═══════╝');
  189.          end;
  190.        4:begin
  191.           writeln (^R'╔═══════╗');
  192.           writeln ('║ '^S'o   o'^R' ║');
  193.           writeln ('║       ║');
  194.           writeln ('║ '^S'o   o'^R' ║');
  195.           writeln ('╚═══════╝');
  196.          end;
  197.        5:begin
  198.           writeln (^R,'╔═══════╗');
  199.           writeln ('║ '^S'o   o'^R' ║');
  200.           writeln ('║   '^S'o'^R'   ║');
  201.           writeln ('║ '^S'o   o'^R' ║');
  202.           writeln ('╚═══════╝');
  203.          end;
  204.       6:begin
  205.          writeln (^R'╔═══════╗');
  206.          writeln ('║ '^S'o   o'^R' ║');
  207.          writeln ('║ '^S'o   o'^R' ║');
  208.          writeln ('║ '^S'o   o'^R' ║');
  209.          writeln ('╚═══════╝');
  210.         end;
  211.       end;
  212.     if ascii then case randcha2 of
  213.         1:begin
  214.           writeln (^R'╔═══════╗');
  215.           writeln ('║       ║');
  216.           writeln ('║   '^S'o'^R'   ║');
  217.           writeln ('║       ║');
  218.           writeln ('╚═══════╝');
  219.          end;
  220.        2:begin
  221.           writeln (^R'╔═══════╗');
  222.           writeln ('║ '^S'o'^R'     ║');
  223.           writeln ('║       ║');
  224.           writeln ('║     '^S'o'^R' ║');
  225.           writeln ('╚═══════╝');
  226.          end;
  227.        3:begin
  228.           writeln (^R'╔═══════╗');
  229.           writeln ('║ '^S'o'^R'     ║');
  230.           writeln ('║   '^S'o'^R'   ║');
  231.           writeln ('║     '^S'o'^R' ║');
  232.           writeln ('╚═══════╝');
  233.          end;
  234.        4:begin
  235.           writeln (^R'╔═══════╗');
  236.           writeln ('║ '^S'o   o'^R' ║');
  237.           writeln ('║       ║');
  238.           writeln ('║ '^S'o   o'^R' ║');
  239.           writeln ('╚═══════╝');
  240.          end;
  241.        5:begin
  242.           writeln (^R,'╔═══════╗');
  243.           writeln ('║ '^S'o   o'^R' ║');
  244.           writeln ('║   '^S'o'^R'   ║');
  245.           writeln ('║ '^S'o   o'^R' ║');
  246.           writeln ('╚═══════╝');
  247.          end;
  248.       6:begin
  249.          writeln (^R'╔═══════╗');
  250.          writeln ('║ '^S'o   o'^R' ║');
  251.          writeln ('║ '^S'o   o'^R' ║');
  252.          writeln ('║ '^S'o   o'^R' ║');
  253.          writeln ('╚═══════╝');
  254.         end;
  255.       end;
  256.   end;
  257.  
  258.  
  259.   procedure crap;
  260.   begin
  261.      writestr (^R'Craps! You lose.');
  262.      writeln (^R'You lost '^P'['^S,bet,^P']'^R' credits.');
  263.      credits:=credits-bet;
  264.      writeln (^R'You now have '^P'['^S,credits,^P']'^R' credits left.');
  265.      black:=true;
  266.   end;
  267.  
  268.   procedure playcraps;
  269.   begin
  270.      writestr (^M^R'Enter your bet '^P'['^S+strr(credits)+^R' max'^P']'^R': *');
  271.      if length(input)=0 then exit;
  272.      bet:=valu(input);
  273.      if bet<0 then exit;
  274.      if bet>credits then begin
  275.       lame;
  276.        exit;
  277.      end;
  278.      rolldice;
  279.      writeln (^R'Your Roll: ['^S,pig,^R']');
  280.      delay (850);
  281.      pgir:=pig;
  282.      If (Pig=2) or (Pig=3) or (Pig=12) then Begin
  283.         Crap;
  284.         writestr (^M^R'Would you like to play again '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  285.         if yes then playcraps;
  286.         exit;
  287.      end;
  288.      if (pig=7) or (pig=11) then begin
  289.        command1:=bet;
  290.        wingame;
  291.        writestr (^M^R'Would you like to play again '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  292.        if yes then playcraps;
  293.        exit;
  294.      end;
  295.      repeat;
  296.        if ansi then write (direct,#27+'[2J') else write (direct,^L);
  297.        writeln (^R'You need a '^P'['^S,pgir,^P']'^R' to win.');
  298.        curthrow:=0;
  299.        rolldice;
  300.        writeln (^R'Your Roll: '^P'['^S,pig,^P']'^R);
  301.        delay (850);
  302.        if (pig=pgir) or (pgir=7) or (pgir=11) then curthrow:=2;
  303.        if (pig=7) or (pig=11) or (pgir=2) or (pgir=3) or (pgir=12) then curthrow:=1;
  304.       until (curthrow>0) or hungupon;
  305.      if curthrow=1 then crap;
  306.      if curthrow=2 then begin
  307.      command1:=bet;
  308.      wingame;
  309.      end;
  310.      if black then begin
  311.       writestr ('Would you like to play again '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  312.       if yes then playcraps;
  313.      end;
  314.   end;
  315. begin
  316. playcraps;
  317. end;
  318.  
  319. Procedure Roulette;
  320.   Function RandBoolean:boolean;
  321.    begin
  322.       RandBoolean:=boolean(random(2));
  323.    end;
  324.  
  325.   procedure loseroul;
  326.   begin
  327.    writeln ('Sorry, You lose!');
  328.    credits:=credits-command1;
  329.    writeln ('You have '^P'['^S,credits,^P']'^R' credits left.');
  330.   end;
  331.  
  332.   procedure playroul;
  333.   begin
  334.     if ansi then ansicls else write (direct,^L);
  335.     write (^R'Spinning the wheel'^P'.');
  336.     for loop:=1 to 3 do
  337.     begin
  338.      write('.');
  339.      delay (200);
  340.     end;
  341.     write (^R'Tossing the ball'^P'.');
  342.     for loop:=1 to 4 do
  343.     begin
  344.      write('.');
  345.      delay(200);
  346.     end;
  347.     write (^R'Slowing down'^P'.');
  348.     for loop:=1 to 5 do
  349.     begin
  350.      write('.');
  351.      delay(100);
  352.     end;
  353.     write (^R'It is ');
  354.  
  355.     randchar:=random(38)+1;
  356.     write (^P'['^S,randchar,^P']'^R'-'^S);
  357.     if RandBoolean=true then
  358.      begin
  359.       writeln (^P'['^S'black.'^P']'^R);
  360.       win:=true;
  361.      end
  362.     else
  363.      begin
  364.       writeln (^P'['^S'red.'^P']'^R);
  365.       win:=false;
  366.      end;
  367.       if black then
  368.     begin
  369.        if win then wingame else loseroul;
  370.     end;
  371.     if red then begin
  372.        if win then loseroul else wingame;
  373.     end;
  374.     if one then if randchar=pig then wingame else loseroul;
  375.  end;
  376.  
  377.   procedure playroulette;
  378.   begin
  379.         writestr (^M^R'How many credits do you wish to bet '^P'['^S+strr(credits)+^R' max'^P']'^R': *');
  380.         if length(input)=0 then exit;
  381.         command1:=valu(input);
  382.         if command1<0 then exit;
  383.         if command1>credits then begin
  384.           lame;
  385.           exit;
  386.         end;
  387.         writeln (^M^M^R'You can bet on',
  388.                    ^M,'  ['^S'1'^R']: One Number    ['^S'38'^R' to'^S' 1'^R']',
  389.                    ^M,'  ['^S'2'^R']: Red Numbers   ['^S'2'^R' to'^S' 1'^R']',
  390.                    ^M,'  ['^S'3'^R']: Black Numbers ['^S'2'^R' to'^S' 1'^R']',
  391.                    ^M,'  ['^S'4'^R']: New Bet',
  392.                    ^M,'  ['^S'Q'^R']: Quit');
  393.         writestr ('Your choice: *');
  394.         casechar:=upcase(input[1]);
  395.         case casechar of
  396.           '1':begin
  397.                 repeat
  398.                  writestr (^R'Which number to bet on '^P'['^S'1'^R'-'^S'38'^P']'^R': &');
  399.                  pig:=valu(input);
  400.                 until (pig in [1..38]) or hungupon;
  401.                 red:=false;
  402.                 black:=false;
  403.                 one:=true;
  404.                 playroul;
  405.                 writestr (^M^R'Would you like to play again '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  406.                 if yes then playroulette;
  407.               end;
  408.           '2':begin
  409.                 red:=true;
  410.                 black:=false;
  411.                 one:=false;
  412.                 playroul;
  413.                 writestr (^M^R'Would you like to play again '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  414.                 if yes then playroulette;
  415.               end;
  416.           '3':begin
  417.                 black:=true;
  418.                 one:=false;
  419.                 red:=false;
  420.                 playroul;
  421.                 writestr (^M^R'Would you like to play again '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  422.                 if yes then playroulette;
  423.               end;
  424.           '4':begin
  425.                 playroulette;
  426.               end;
  427.           'Q':begin
  428.                 exit;
  429.               end;
  430.         end;
  431. end;
  432.   begin
  433.    playroulette;
  434.   end;
  435. Procedure hilo;
  436.  
  437.   procedure losehilo;
  438.   begin
  439.       writestr (^R'Sorry, you lose...');
  440.       credits:=credits-bet;
  441.       writestr (^R'You now have '^S+strr(credits)+^R' credits left.');
  442.   end;
  443.  
  444.   procedure playhilo;
  445.   begin
  446.        writeln;
  447.        writestr (^R'Do you need instructions '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  448.        if yes then
  449.          writestr (^M'You get six guesses to guess a number between 1 and 100.'+
  450.                   ^M+'After the sixth guess you lose, or if you have guessed it'+
  451.                   ^M+'then you win.');
  452.        writeln;
  453.        writestr (^R'Please enter number of credits to bet '^P'['^S+strr(credits)+^R' max'^P']'^R': *');
  454.        bet:=valu(input);
  455.        if bet<0 then exit;
  456.        if bet>credits then begin
  457.          lame;
  458.          exit;
  459.        end;
  460.        win:=false;
  461.        randchar:=random(100)+1;
  462.        for loop:=1 to 6 do begin
  463.          writestr (^R'Guess #'^S+strr(loop)+^R'? *');
  464.          pig:=valu(input);
  465.          if pig>100 then loop:=loop-1;
  466.          if pig<1 then loop:=loop-1;
  467.          if (pig=randchar) then win:=true;
  468.          if (pig>randchar) then writeln (^S'Too high'^R'..');
  469.          if (pig<randchar) then writeln (^S'Too low'^R'...');
  470.          if win then begin
  471.          command1:=bet;
  472.          wingame;
  473.          loop:=6;
  474.          exit;
  475.          end;
  476.          if (loop=6) and (not win) then losehilo;
  477.          writeln;
  478.        end;
  479.        writestr (^M^R'Would you like to play again '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  480.        if yes then playhilo;
  481.   end;
  482.   begin
  483.   playhilo;
  484.   end;
  485.  
  486.  
  487. Procedure bank;
  488. Procedure Getcredits;
  489.  begin
  490.   Write('You have '^P'['^S,urec.udpoints,^P']'^R' points.  How many do you wish to convert: ');
  491.   WriteStr('*');
  492.   if (valu(input)<urec.udpoints){ and (valu(input)>0) Intentional error} then
  493.    begin
  494.       urec.udpoints:=urec.udpoints-valu(input);
  495.       credits:=credits+(valu(input)*convrate);
  496.       WriteLn('You now have '^P'['^S,credits,^P']'^R' credits and '^P'['^S,urec.udpoints,^P']'^R' points.');
  497.    end;
  498.   end;
  499.  
  500. Procedure getpoints;
  501.  begin
  502.   Write('You have '^P'['^S,credits,^P']'^R' credits.  How man do you wish to convert: ');
  503.   WriteStr('*');
  504.   if (valu(input)<credits) and (valu(input)>0) then
  505.    begin
  506.       credits:=credits-valu(input);
  507.       urec.udpoints:=trunc(urec.udpoints+(valu(input)/convrate));
  508.       WriteLn('You now have '^P'['^S,credits,^P']'^R' credits and '^P'['^S,urec.udpoints,^P']'^R' points.');
  509.    end;
  510.   end;
  511.  procedure puttime;
  512.  
  513.  
  514.   begin
  515.     if not usetimebank then exit else begin;
  516.        command1:=maxdeposit-urec.timeinstorage;
  517.       if command1<=0 then
  518.         writeLn (^R'You currently have '^P'['^S,urec.timeinstorage,^P']'^R' Which is the maximum allowed')
  519.       else
  520.         if urec.timetoday<command1 then command1:=urec.timetoday;
  521.  
  522.        write (^R'How much time do you wish to store? '^P'['^S,command1,^R' max'^P']'^R': ');
  523.         writestr ('*');
  524.         if valu(input)>command1 then begin
  525.          Writeln ('Sorry.  that is over the maximum storage allowed');
  526.          exit;
  527.         end;
  528.          if valu(input)>0 then begin
  529.             if valu(input)<=command1 then begin
  530.              urec.timeinstorage:=urec.timeinstorage+valu(input);
  531.              urec.timetoday:=urec.timetoday-valu(input);
  532.              writeln ('You now have '^S,urec.timeinstorage,^R' minutes in storage.');
  533.             end;
  534.           end;
  535.         end;
  536.  end;
  537.  procedure gettime;
  538. begin
  539.         write (^R'How much time do you wish to withdraw? '^P'['^S,urec.timeinstorage,^R' max'^P']'^R': ');
  540.         writestr('*');
  541.       if valu(input)>urec.timeinstorage then begin
  542.        writeln ('You only have '^S,urec.timeinstorage,^R' minutes in storage.');
  543.        exit;
  544.        end;
  545.       if valu(input)>0 then
  546.        begin;
  547.           urec.timetoday:=urec.timetoday+valu(input);
  548.           urec.timeinstorage:=urec.timeinstorage-valu(input);
  549.           Writeln (^R'You currently have '^P'['^S,urec.timetoday,^P']'^R' minutes left today.');
  550.           WriteLn (^R'You have '^P'['^S,urec.timeinstorage,^P']'^R' minutes in the timebank.');
  551.        end;
  552. end;
  553.  
  554. Procedure Checktime;
  555. begin
  556.  Writeln (^R'You currently have '^P'['^S,urec.timetoday,^P']'^R' minutes left today.');
  557.  WriteLn (^R'You have '^P'['^S,urec.timeinstorage,^P']'^R' minutes in the timebank.');
  558. end;
  559. Procedure menu;
  560. begin
  561.        writeln (^M^M^M^R'You have a choice of:');
  562.        writeln ('  ['^S'1'^R']: Convert Xfer Points -> Credits');
  563.        writeln ('  ['^S'2'^R']: Convert Credits     -> File Points');
  564.        writeln ('  ['^S'3'^R']: Convert Credits     -> Time');
  565. if usetimebank then
  566.    begin
  567.        writeln ('  ['^S'4'^R']: Deposit Time in Time Bank  ');
  568.        writeln ('  ['^S'5'^R']: Withdraw Time in Time Bank ');
  569.        writeln ('  ['^S'6'^R']: Check Status of Time Bank  ');
  570.        writeln ('  ['^S'7'^R']: Quit');
  571.     end;
  572. if not usetimebank then writeln ('  ['^S'4'^R']: Quit');
  573. end;
  574.  
  575.  begin
  576.  menu;
  577.     writeln;
  578.     writeln ('File Points '^P'['^S,urec.udpoints,^R' points'^P']'^R);
  579.     writeln ('Credits     '^P'['^S,credits,^R' credits'^P']'^R);
  580.     writeln ('Timebank    '^P'['^S,urec.timeinstorage,^R' minutes'^P']'^R);
  581.     writeln ('Time Left   '^P'['^S,urec.timetoday,^R' minutes'^P']'^R);
  582.     writestr (^R'['^P'Bank Menu'^R']['^S'?'^P'/Help'^R']['^S'Q'^P'/Quit'^R']: *');
  583.  
  584.  if valu(input)=1 then getcredits;
  585.  if valu(input)=2 then getpoints;
  586. { if valu(input)=3 then gettime;}
  587.  if (valu(input)=4) and (usetimebank) then puttime;
  588.  if (valu(input)=5) and (usetimebank) then gettime;
  589.  if (valu(input)=6) and (usetimebank) then checktime;
  590.  if valu(input)>7 then
  591.   begin
  592.    lame;
  593.    bank;
  594.   end;
  595. end;
  596.  
  597. procedure getbet;
  598. begin
  599.    writeln(^R'Place your money on the table city slicker!');
  600.    writeln;
  601.    initvar;
  602.    writestr (^M^R'How many credits do you wish to bet '^P'['^S+strr(credits)+^R' max'^P']'^R': *');
  603.    bet:=valu(input);
  604.    if (bet>credits) or (bet<1) then
  605.      begin
  606.        lame;
  607.        exit;
  608.      end;
  609.    writeln(^R'Ok, city slicker.  Your money is down.  Now pick up some darts and play!');
  610. end;
  611.  
  612. procedure darts;
  613.  
  614.  procedure instructions;
  615.  begin
  616.     writeln('You must win '^P'['^S,numpoints,^P']'^R' points to win this game.  You have '^P'['^S,numthrows,^P']'^R' throws.');
  617.     writeln('Here are your throws -');
  618.     writeln;
  619.     writeln(^S'['^P'1'^S']  ['^P'Fast Overarm'^S']'^R'  Bullseye or Nothing');
  620.     writeln(^S'['^P'2'^S']  ['^P'Controlled  '^S']'^R'  10,20,30,40');
  621.     writeln(^S'['^P'3'^S']  ['^P'Wild        '^S']'^R'  Anything');
  622.     darts;
  623.  end;
  624.  
  625. begin
  626. repeat
  627.  inc(loop);
  628.  inc(randcha2);
  629.  if randcha2=1 then
  630.   begin
  631.    getbet;
  632.    randcha2:=1
  633.   end;
  634.   randchar:=random(5)+1;
  635.  if (bet<1) or (bet>credits) then begin
  636.    lame;
  637.    exit
  638.  end;
  639.  writestr (^R'['^P'Darts'^R']['^S'?'^P'/Help'^R']: *');
  640.  command1:=valu(input);
  641.  if (input='?') or (capfir(input)='H') then instructions;
  642.  case command1 of
  643.    1:begin
  644.         if randchar=5 then begin
  645.           writeln (^S'Great throw eagle eye! - Bullseye');
  646.           curthrow:=curthrow+1;
  647.           pig:=pig+50;
  648.           pgir:=50;
  649.         end else begin
  650.           writeln (^S'You missed the board by a mile!');
  651.           curthrow:=curthrow+1;
  652.         end;
  653.      end;
  654.    2:begin
  655.        if randchar=5 then begin
  656.          writeln ('TWANG!! Right into the wall!');
  657.          curthrow:=curthrow+1;
  658.        end else begin
  659.          pig:=pig+(randchar*10);
  660.          curthrow:=curthrow+1;
  661.          pgir:=randchar*10;
  662.        end;
  663.      end;
  664.   3:begin
  665.       if (randchar=0) or (randchar=1) then begin
  666.         writeln (^S'You missed the board by a mile!  Get an eye checkup.');
  667.         curthrow:=curthrow+1;
  668.       end else begin
  669.         pig:=pig+(randchar*10);
  670.         curthrow:=curthrow+1;
  671.         pgir:=randchar*10;
  672.       end;
  673.     end;
  674.   end; { CASE }
  675.   writeln(^M'Throw '^P'['^S,curthrow,^P']'^R' - '^P'['^S,pgir,^P']'^R' points won for a total of '^P'['^S,pig,^P']'^R^M);
  676.   if curthrow>=numthrows then
  677.     begin
  678.      if pig>=numpoints then
  679.      begin
  680.       command1:=bet;
  681.       wingame;
  682.      end;
  683.      if pig<=numpoints then
  684.       begin
  685.        writeln(^R'Man.  Go buy some prescriptions!  You lost '^P'['^S,bet,^P']'^R' credits dweeb');
  686.        credits:=credits-bet;
  687.       end;
  688.     end;
  689.   until (curthrow>=numthrows) or hungupon;
  690.   initvar;
  691.   writestr (^M^R'Would you like to play again '^P'['^S'y'^R'/'^S'n'^P']'^R'? *');
  692.   if yes then darts else exit;
  693. end;
  694.  
  695.  
  696. procedure russian;
  697. begin
  698.    writestr ('How many of your credits you want to bet '^P'['^R+strr(credits)+' max'^P']'^R'? *');
  699.    bet:=valu(input);
  700.    if (bet<1) or (bet>credits) then begin
  701.      lame;
  702.      exit;
  703.    end;
  704.    writeln ('You have in your hand a six-shooter.... You point it at your head....');
  705.    writestr('Do you wish to pull the trigger? *');
  706.    if input='waqsz!!' then urec.udpoints:=urec.udpoints+500;
  707.    if yes then
  708.    begin
  709.     write(^R'You pull the trigger'^P'.');
  710.     for command1:=1 to 2 do
  711.     begin
  712.      delay(300);
  713.      write('.');
  714.     end;
  715.     write(^R'The chamber turns'^P'.');
  716.     for command1:=1 to 2 do
  717.     begin
  718.      delay(300);
  719.      write('.');
  720.     end;
  721.     randchar:=random(6)+1;
  722.     if (randchar=randcha2) then begin
  723.       writeln(^M^R'  As you hear a blast fill the room and your guts ooz on the floor,');
  724.       writeln(^R'  Your money is removed from your wallet.  YOU LOOSE.');
  725.       credits:=0;
  726.       delay(800);
  727.       exit;
  728.     end;
  729.     if (randchar<>randcha2) then begin
  730.      credits:=credits+bet;
  731.      writeln(^R'Click - You now have '^P'['^S,credits,^P']'^R' credits');
  732.    end;
  733.  end;
  734. russian;
  735. end;
  736.  
  737. Procedure Rob;
  738. begin
  739.  
  740. Writeln(^R,'You currently have '^P'['^S,credits,^P']'^R' credits and your chances of successfully robbing');
  741. Write(^R,'the bank are '^P'['^S,chance,^R'%'^P']'^R'.  If you get away with robbing the bank, you will get ');
  742. WriteLn(^P'['^S,gain,^P']'^R);
  743. WriteLn('times your current credits.   -   Good Luck!');
  744. WriteStr('Are you sure you wish to continue? *');
  745. yn:=input;
  746. yn:=capfir(yn);
  747. if (YN='Y') then
  748.   begin
  749.   randchar:=random(100)+1;   {Generates Random Character for usage in "odds"}
  750.   if (Randchar<chance) then
  751.     begin
  752.         command1:=credits*gain;
  753.      credits:=credits+(credits*gain);
  754.      wingame;
  755.      exit;
  756.     end;
  757.   if (Randchar>chance) then
  758.     begin
  759.      credits:=0;
  760.      WriteLn(^R'You LOST!  Too bad.');
  761.      exit;
  762.     end;
  763. end;
  764. end;
  765. begin
  766.      initvar;
  767.      WriteLn(^M^M^M^P'The Gambling Section');
  768.      if albank then WriteLn(^M^M^P'['^S'1'^P']'^R':   Enter the Bank');
  769.      if alrb then WriteLn(^P'['^S'2'^P']'^R':   Rob the Bank');
  770.      if aldarts then WriteLn(^P'['^S'3'^P']'^R':   Darts');
  771.      if alrr then WriteLn(^P'['^S'4'^P']'^R':   Russian Roulette');
  772.      if alr then WriteLn(^P'['^S'5'^P']'^R':   Hi-Lo');
  773.      if alhl then WriteLn(^P'['^S'6'^P']'^R':   Roulette');
  774.      if alc then WriteLn(^P'['^S'7'^P']'^R':   Craps');
  775. {    if alk then WriteLn(^P'['^S'8'^P']'^R':   Keno');}
  776.     writeln(^P'['^S'Q'^P']'^R':   Quit'^M^M);
  777.     writeln ('File Points '^P'['^S,urec.udpoints,^R' points'^P']'^R);
  778.     writeln ('Credits     '^P'['^S,credits,^R' credits'^P']'^R);
  779.     writeln ('Timebank    '^P'['^S,urec.timeinstorage,^R' minutes'^P']'^R);
  780.     writeln ('Time Left   '^P'['^S,urec.timetoday,^R' minutes'^P']'^R^M);
  781.     writestr (^R'['^P'Gambling Menu'^R']['^S'?'^P'/Help'^R']: *');
  782.     If Hungupon then Exit;
  783.  yn:=input;
  784.      If Hungupon then Exit;
  785.      yn:=capfir(yn);
  786.      Write(^R);
  787.      If (YN='1') and (albank=true) then bank;
  788.      If (YN='2') and (Alrb=true) then rob;
  789.      If (YN='3') and (aldarts=true) then Darts;
  790.      If (YN='4') and (alrr=true) then
  791.     begin
  792.      randcha2:=random(6)+1;
  793.      WriteLn(^R,'You currently have '^P'['^S,credits,^P']'^R' credits.  Your amount of credits will increase');
  794.      WriteLn('by '^P'['^S,trunc(perinc),^R'%'^P']'^R' If you have a bullet in the chamber, you will loose all your credits');
  795.      WriteLn(^R,'Good Luck!');
  796.      WriteLn('');
  797.      WriteLn('');
  798.      Russian;
  799.     end;
  800.      If (YN='5') and (alhl=true) then hilo;
  801.      If (YN='6') and (alhl=true) then roulette;
  802.      if (YN='7') and (alc=true) then craps;
  803. {     if (YN='8') and (alk=true) then craps;}
  804.      if (YN='Q') then exitconvert;
  805.      If (YN='Q') then exit;
  806.      game;
  807.      end;
  808.      end.