Radio Shack TRS-80 PC-3 Owner's Manual page 191

Table of Contents

Advertisement

expected payoff will be slightly less than the expected cost. If desired, it is also easy to add more complex winning rules with
different payoffs. Variables are also set to control the length of the free-wheeling and slow-down periods.
Slot Machine Simulation Program
10: S
=
0: F
=
10: G
=
90: H
=
200
20:T
=
3: Z
=
INT (((TI\3) -1)/T}: C
=
3*T: B
=
6*T
30: DIM R(3), 0(3), P$(T) * 8
40: RANDOM
50: FOR 1= 1 TO 3
60: DO)
=
RND(T}
70: NEXT I
80: FOR 1= 1 TO T
90: READ P$O)
100: NEXT I
110: DATA" ORANGE "," LEMON "," CHERRY"
120:WAIT H
130: PRINT "1$ SLOT MACHINE"
140: WAIT
150: PRINT "PRESS ENTER TO START"
200: REM***START OF TURN* * *
210: M = 0
Set initial variables - S is amount of winnings, F is amount of PRINT
WAIT during first part of spin, G is longest print WAIT in spin, and H
is PRINT WAIT for information massages
T is number of objects, Z is earning from a win, C is length of fast spin,
B is maximum length of slow spin portion
Allocate space for arrays - R ( ) is how many positions each wheel will
turn, D ( ) is number of current objects, p$ ( ) is names of objects
Randomize seed for RND ( )
Initialize the object for each "window" to a random value
Read in the names of the objects
Spaces are added to make each
8
characters
Set WAIT for start message
Announce start
Reset WAIT to wait for Enter
Wait for Enter to begin
Initialize M
191

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents