Title: ファミリースロットマシン (Family Slot Machine)
System: Family Basic
Author: 
Publication: 任天堂 ファミリーコンピュータ ファミリーベーシック PERFECT BOOK (Nintendo Family Computer and Family Basic Perfect Book)	
Page Scans: 
Preserved By: ozidual
Recommended Emulator: VirtualNES

Keyboard Needed.

Article Translation

This program is a slot machine game using characters built into Family Basic.
When you run the program, the message "BET?" will be displayed. Please enter the bet amount from the keyboard. Bets range from 1 to 10.
When you have finished entering the information and pressed the return key, the payout according to the amount of your bet will be displayed, the bet will be deducted from your CREDIT, and the slot machine will start. Press the 1, 2, 3 keys in sequence to stop each slot one by one, or press only the 3 key to stop all the slots. If the three characters displayed when the slots stop are the same type, you will get the payout shown and it will be added to your CREDIT. When CREDIT reaches 0, the system will ask you "PLAY AGAIN?". To play the game, press any key other than N and then press the return key.
Please note that you cannot bet more than 10, but you also cannot make a bet where the CREDIT minus the bet is less than 0.


Program Description

10-20 - Initial settings for screens and variables
30 - Initial character settings
35-60 - Set animated characters as sprites
70-90 - Animate character display
100 - Assigning key input values
110-130 - Determining key input values
140-200 - Processing for rotating slots
210-250 - Determining whether the characters are the same on the stopped slot
320 - Display of dividends
330 - Erase the right side of the screen
340-350 - Determine if CREDIT remains
360-380 - Replay and program end processing
800-840 - Display of dividends
910 - View CREDIT
920-950 - Entering bets and processing input values


Code

10 CLS:CGSET1,0:SPRITE ON:VIEW:CO=100:PLAY"T1"
20 F1=0:F2=0:F3=0:RE=1:BE=0:GOSUB 800
30 R1=RND(23)*4:R2=RND(23)*4:R3=RND(23)*4
35 IF F1=1 THEN 45
40 DEF SPRITE0,(0,1,1,0,0)=CHR$(R1)+CHR$(R1+1)+CHR$(R1+2)+CHR$(R1+3)
45 IF F2=1 THEN 60
50 DEF SPRITE1,(0,1,1,0,0)=CHR$(R2)+CHR$(R2+1)+CHR$(R2+2)+CHR$(R2+3)
60 DEF SPRITE2,(0,1,1,0,0)=CHR$(R3)+CHR$(R3+1)+CHR$(R3+2)+CHR$(R3+3)
70 SPRITE 0,40,80
80 SPRITE 1,64,80
90 SPRITE 2,88,80
100 ST$=INKEY$
110 IF ST$="1" THEN F1=1
120 IF ST$="2" THEN F2=1
130 IF ST$="3" THEN F3=1
140 IF F1=1 THEN 160
150 R1=R1+4:IF R1>92 THEN R1=0
160 IF F2=1 THEN 180
170 R2=R2+4:IF R2>92 THEN R2=0
180 IF F3=1 THEN 210
190 R3=R3+4:IF R3>92 THEN R3=0
200 PLAY "O5C0":GOTO 35
210 IF (R1=88 OR R1=92) AND (R2=88 OR R2=92) AND (R3=88 OR R3=92) THEN WI=100
220 IF (R1=56 OR R1=60) AND (R2=56 OR R2=60) AND (R3=56 OR R3=60) THEN WI=80
230 IF (R1>=64 AND R1<=84) AND (R2>=64 AND R2<=84) AND (R3>=64 AND R3<=84) THEN WI=60
240 IF (R1>=28 AND R1<=52) AND (R2>=28 AND R2<=52) AND (R3>=28 AND R3<=52) THEN WI=40
250 IF (R1>=0 AND R1<=24) AND (R2>=0 AND R2<=24) AND (R3>=0 AND R3<=24) THEN WI=20
320 LOCATE 17,19:PRINT"YOU GET";RE*WI:CO=CO+RE*WI:PAUSE 100:WI=0
330 FOR I=0 TO 21:LOCATE 17,I:PRINT"           ";:NEXT
340 IF CO>0 THEN 20
350 CLS:SPRITE OFF:LOCATE 7,10:PRINT"YOU BUST !!"
360 LOCATE 6,12:INPUT"PLAY AGAIN";AG$
370 IF AG$<>"N" THEN RUN
380 CLS:END
800 LOCATE 17,7:PRINT"ニタニタ ";RE*100;
810 LOCATE 17,8:PRINT"ハエ    ";RE*80;
820 LOCATE 17,9:PRINT"アキレス  ";RE*60;
830 LOCATE 17,10:PRINT"レデイ   ";RE*40;
840 LOCATE 17,11:PRINT"マリオ   ";RE*20;
910 LOCATE 17,14:PRINT"CREDIT":LOCATE 17,15:PRINT CO;"  "
915 IF BE>0 THEN RETURN
920 LOCATE 17,17:INPUT"BET";BE
930 IF BE>10 OR CO-BE<0 THEN 920
940 RE=BE:CO=CO-BE
950 GOTO 800
