This section is from the document '/pub/list_archives/calc-ti.archive/calc-ti-9502'.

From owner-calc-ti Sat Feb 11 11:06:47 EST 1995 remote from ds
Received: by ds.internic.net; Sat Feb 11 11:06:41 EST 1995
Received: from AUVM.AMERICAN.EDU by AUVM.AMERICAN.EDU (IBM VM SMTP V2R2)
   with BSMTP id 5065; Sat, 11 Feb 95 11:05:36 EST
Received: from AUVM.AMERICAN.EDU (NJE origin NETNEWS@AUVM) by AUVM.AMERICAN.EDU
 (LMail V1.2a/1.8a) with BSMTP id 9117; Sat, 11 Feb 1995 11:05:37 -0500
To:  CALC-TI@LISTS.PPP.TI.COM
Path: auvm!paladin.american.edu!howland.reston.ans.net!news.moneng.mei.com!
  uwm.edu!msunews!netnews.upenn.edu!cronkite.ocis.temple.edu!astro.ocis.temple.e
 du!adrianrc
From: adrianrc@astro.ocis.temple.edu (Adrian Cybriwsky)
Newsgroups: bit.listserv.calc-ti
Subject: Calc-TI - Ti-81 Code: Slot Machine
Date: 11 Feb 1995 14:36:32 GMT
Organization: Temple University, Academic Computer Services
Lines: 255
Message-ID: <3hii1g$cn3@cronkite.ocis.temple.edu>
NNTP-Posting-Host: astro.ocis.temple.edu
X-Newsreader: TIN [version 1.2 PL2]
Sender: owner-calc-ti@dsmail.internic.net
Precedence: bulk
Reply-To: adrianrc@astro.ocis.temple.edu (Adrian Cybriwsky)

here's a slot machine i wrote [quite] a while ago for my Ti-81.  it uses
a considerable amount of ti-memory [about 1.1k, if i remember correctly]
and is not graphical.  still, it's not bad.


the following is the 'source code' for the game 'zero slots' for the
texas instruments Ti-81 graphing calculator.  if inputted correctly,
it will result in a slot machine game complete with betting.  this program
may also work on newer texas instruments calculators, notably the ti-85,
but this is not confirmed.

this file and the program are copyright 1994, adrian cybriwsky and may
not
be modified without permission.  the author makes no claims as to the
working of this program, and holds himself free from any responsibility
regarding its use, including if you blow up your calculator while punching
it in.  this file may be distributed freely in unmodified state in
electronic form, but may be printed (put to paper) only for personal use in
assisting transcription to calculator memory.  no fee may be charged for the
distribution of this document.

adrian cybriwsky may be reached at adrianrc@astro.ocis.temple.edu

notes:
      - this is version 2.0!

The following "improvements" have been made over version 1.0
      - i discovered how to implement some elements of combinational logic,
        and the source was modified accordingly.  affected pieces now take up
        less space and memory.
      - A "high score" register and screen was added.
      - A system of 'turns' was implemented.  This makes the game more
        interesting as a somewhat greater degree of strategy is now required.
      - straights "down" as well as "up" are now registered as winners.
      - the PC copy of the program fixes some erorrs in typing from the
        previous version.

        memory, i sincerely doubt there will be further versions (but, who
        knows?)  there are a few bugs in this version which i *am* aware of.
        however, fixing them would require using additional registers
        (variables) and/or memory, and as the problems (that i predict) will
        occur so infrequently, i decided to leave them alone.  One error that
        you might want to fix is the limited-recursive program call problem.
        This means, if you go bankrupt about 10 or so successive times, and
        elect to restart (via option 1 of the bankrupt screen) each time, on
        the 10th or so time, the program will crash.  this is easily fixable
        as follows.  Add a line to the very beginning of the program that
        reads "Lbl J."  Edit the last line, which currently reads "Prgm3" to
        "Goto J."  Simple enough!
      - there is an obvious display problem as far as the zeroes are
        concerned.. namely, the digit "007" (for example) appears as "7" and
        the zeroes are not shown.  i could have written code to simply not
        use zeroes, but that would just add code.  because i have not
        included this code, some players may not understand why they have
        won when they have.
      - "you win 1 dollar" means you just won back the dollar you put in
        for a net gain of zero.
      - i wrote this game in chemistry lecture because chemistry lecture is
        boring as hell.  not that chemistry is bad..   as it were, i find
        programming the ti-81 to satisfy my soul somehow.  something zen about
        it.  sure, i can program absolutely beautifully in yer fancy-schmancy
        programming languages with 27 install disks and a compiler that is
        ultimately forgiving.. but there is a real elegance involved in writing
        for the Ti-81 that is lost elsewhere.  while my program is not perfect
        (many lines could be elimenated/compacted; it's obvious), it has a kind
        of beauty [pshaw]... oh well.
      - you might want to tailor the spin mechanism to your own taste.  for
        example, you might want the numbers to stop left to right instead of
        right to left as they are now.  hey. feel free.
      - if you like this program, please fax me a dollar so i can buy a better
        calculator, preferably one with a serial attachment for my PC.

briefly, some notation:

->      assignment indicator.  the "STO>" button on the calculator
!=      does not equal.  Equals with a slash through it
>=, <=  greater than or equal, less than or equal
{theta} the letter gotten by pressing ALPHA, 3.  Usually refers to angles.
_-_-_-  this is a border drawing method to add some nice looking screens.
        there is no underscore character on the TI-81, but there are two
        minus signs.  One is BLUE (above +) and one is grey (left of ENTER).
        Alternating these makes a nice pattern.


everything after a pound (#) sign on a program line is a comment, and should
not be inputted.

Prgm3: SLT                    # suggested title

Disp " **************"
Disp " * ZERO SLOTS *"
Disp " **************"
Disp ""
5000->C                       # C - player's cash
20->T
1->B                          # B - player's bet
Pause
Lbl R
Disp "      YOUR CASH"
Disp C
Disp "    CURRENT BET"
Disp B
Disp "     TURNS LEFT"
Disp T
Paus
If B>C                        # as the screen will scroll too fast.
Goto S
If T<= 0
Goto 3
0->Y                          # Y deals with the slot-display
Disp " ==ZERO SLOTS=="
Disp ""
Disp "1-PULL LEVER"
Disp "2-CHANGE BET"
Disp "3-SEE PAYOFFS"
Disp "4-HIGH SCORES"
Disp "5-BUY TURN"

Input D
If D=1
Goto V
If D=2
Goto S
Id D=4
Goto 1
If D=5
Goto 2
Disp "---ODDS TABLE--"        # default is to see odds table
Disp "ANY 0.........1"
Disp "1ST 2.........5"        # NNX
Disp "1ST+2ND=3RD..10"
Disp "3 OF A KIND..50"
Disp "STRAIGHT....100"        # straight has to be in order.  not 3,1,2
Disp "3 ZEROES....250"        # appears on display as "0"
Pause
Goto R
Lbl S
Disp "ENTER NEW BET"
Input B
IPart B->B                    # whole dollar bets only!
If B>=1
Goto R
Goto S
Lbl V
Y+1->Y
If Y=4
Goto U
IPart (Rand*10/Y)+Y*4->X      # change values here to change duration of spin
Lbl T
(10^(Y-1))+(10^Y)+(10^(Y+1))+Z>->Z
Lbl I
If Z>=1000                    # this part can take a while if at the
beginning
Z-1000->Z
If Z>=1000
Goto I                        # z is very large (ie 2.3E22)
Disp Z
X-1->X
If X=0
Goto V
Goto T
Lbl U
0->A
IPart (Z/100)->D
IPart (10*(FPart (Z/100))->E
IPart (10*(FPart (Z/10))->F
B*((D=0)+(E=0)+(F=0))->A
A+(5B(D=E))->A
If (D=E-1)+(E=F-1)=2
100*B->A
If (F=E-1)+(E=D-1)=2
100*B->A
If  (D=E)+(E=F)=2
50*B->A
If D+E=F
10*B->A
If (D=0)+(E=0)+(F=0)=3
B*250->A
If A>0
Disp "          YOU WIN"
If A=0
Disp "         YOU LOSE"
If A>0
Disp A
If A>1
Disp "          DOLLARS"
If A=1
Disp "           DOLLAR"
C+A-B->C
T-1->T
If C>{theta}
Disp "NEW HIGH SCORE!"
If C>{theta}
C->{theta}
Pause
Disp ""
If C=0
Goto 3
Goto R
Lbl N
Disp "PLAY AGAIN?"
Disp "(0-NO,1-YES)"
Input F
If F=0
End
Prgm3
Lbl 1
DIsp ""
Disp "-_-_-_-_-_-_-_-"
Disp "   HIGH SCORE"
Disp "{theta}"
Disp "-_-_-_-_-_-_-_-"
DIsp ""
Pause
Goto R
Lbl 2
If C=1
Goto R
Disp ""
Disp "BOUGHT 1 TURN"
DIsp "COST-"
IPart (C/20)->L
Disp L
C-L->C
T+1->T
Pause
Goto R
Lbl 3
Disp "-_-_-_-_-_-_-_-"
If C>=1
Disp " OUT OF TURNS!"
If C<=0
Disp "   BANKRUPT!"
Disp "-_-_-_-_-_-_-_-"
Pause
Disp "GAME OVER"
Disp "    FINAL SCORE"
DIsp C
Disp "     HIGH SCORE"
Disp {theta}
Disp "-_-_-_-_-_-_-_-"
Pause
Goto N




--
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  i keep six honest serving men          \/
    (they taught me all i knew);         /\         adrian cybriwsky
  their names are what and why and when  \/  adrianrc@astro.ocis.temple.edu
    and how and where and who. (kipling) /\
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


.
