Title: マリオを探せ！ (Find Mario!)
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

Mario, Luigi, Lady and Fireball are hiding behind the eight doors on the screen. Guess who is hiding behind which door.
However, we don't know how many Marios, Luigis, Ladies, and Fireballs there are, so you'll have to think carefully before you can hit them all.
When you run the program, eight doors will appear and a cursor will flash at the cottom right of each door. Enter the number you guessed using the sample at the top of the screen as a reference. When you have finished entering the number for one door, the cursor will move to the next door. When you have finished entering the number for all the doors, you will be asked if you are OK with it. If you want to make corrections, press "N", or if you are OK with it, press any other key.
Then, it will count the number of characters hiding behind the door, the total number of correct numbers for each character you entered, regardless of their location, and the total number of correct character numbers and locations. Then the cursor will move back to the dfoor, so please think about this until you get the hint.
When the cursor is blinking, if you press any key other than 1 to 4, the will all become 0, and keys such as CLR and -> will not function as they should and will be entered as 0. This is done to prevent the screen from becoming distorted.


Program Description

10 - Initial settings for screens and variables
20 - Declaration of array variables
30-110 - Setting up a character hiding behind a door
120-150 - Setting sample characters
160-190 - Displaying sample characters
200-220 - Door display
230 - Displaying the number of tries
234-250 - Cursor display and key input
260-270 - Deciding whether to correct the problem and taking action
300-346 - Find the number of correct answers
350-360 - Display number of correct answers
370 - Check if all answers are correction
380-390 - What to do if all answers are incorrect
550-590 - Display character behind door
600-620 - Turn off the door
630-640 - Program termination processing


Code

10 CLS:CGSET 1,0:SPRITE ON:VIEW:F=1
20 DIM C(7),P(7),K$(7),K(7)
30 FOR I=0 TO 7
40 C(I)=RND(4)
50 IF C(I)=0 THEN P(I)=0:M1=M1+1
60 IF C(I)=1 THEN P(I)=0:M2=M2+1
70 IF C(I)=2 THEN P(I)=1:M3=M3+1
80 IF C(I)=3 THEN P(I)=5:M4=M4+1
100 DEF MOVE(I)=SPRITE(P(I),0,1,1,1,C(I))
110 NEXT
120 DEF SPRITE 0,(0,1,0,0,0)=CHR$(24)+CHR$(25)+CHR$(26)+CHR$(27)
130 DEF SPRITE 1,(1,1,0,0,0)=CHR$(24)+CHR$(25)+CHR$(26)+CHR$(27)
140 DEF SPRITE 2,(2,1,0,0,0)=CHR$(52)+CHR$(53)+CHR$(54)+CHR$(55)
150 DEF SPRITE 3,(3,1,0,0,0)=CHR$(116)+CHR$(117)+CHR$(118)+CHR$(119)
160 FOR I=0 TO 4
170 SPRITE I,I*32+68,32
180 NEXT
190 LOCATE 7,0:PRINT"1   2   3   4"
200 FOR I=0 TO 7
205 IF I>3 THEN H=I-4:G=6:GOTO 210
206 H=I
210 LOCATE H*7+3,7+G:PRINT CHR$(254);CHR$(254):LOCATE H*7+3,8+G:PRINT CHR$(254); CHR$(254)
220 NEXT
230 LOCATE 3,17:PRINT F;" カイメ";" "
234 FOR I=0 TO 7
235 IF I>3 THEN W=I-4:Z=6:GOTO 240
236 W=I
240 LOCATE W*7+4,8+Z:K$(I)=INKEY$(0):LOCATE W*7+4,8+Z:PRINT K$(I)
250 NEXT
260 LOCATE 3,19:PRINT "コレデ イイ デスカ (Y OR N)?";:S$=INKEY$(0)
270 IF S$="N" THEN Z=0:GOTO 230
280 FOR I=0 TO 7
290 K(I)=VAL(K$(I)):IF K(I)=C(I)+1 THEN A1=A1+1
320 IF K(I)=1 AND B1<M1 THEN B1=B1+1
330 IF K(I)=2 AND B2<M2 THEN B2=B2+1
340 IF K(I)=3 AND B3<M3 THEN B3=B3+1
345 IF K(I)=4 AND B4<M4 THEN B4=B4+1
346 NEXT
350 LOCATE 7,21:PRINT"ニソズウ ノ セイカイ ";B1+B2+B3+B4
360 LOCATE 8,22:PRINT"バショ モ セイカイ ";A1
370 IF A1=8 THEN 500
380 B1=0:B2=0:B3=0:B4=0:F=F+1:Z=0:A1=0
390 GOTO 230
550 FOR I=0 TO 7
560 IF I>3 THEN X=I-4:Y=48:GOTO 580
570 X=I
580 POSITION I,X*56+40,79+Y:MOVE I
590 NEXT
600 FOR I=7 TO 14
610 LOCATE 3,I:PRINT"                           "
620 NEXT
630 LOCATE 10,11:PRINT"セイカイ !!":PAUSE 300
640 CLS:SPRITE OFF:END


Correction

Page 164:

(Jumps to a non-existant location, change to the proper location)
370 IF A1=8 THEN 550