☆電子サイコロ用(スペースキーを押して止める)10 'save"SAI",A 20 SG$(0)="63" 30 SG$(1)="64" 40 SG$(2)="33" 50 SG$(3)="97" 60 SG$(4)="45" 70 SG$(5)="109" 80 SG$(6)="63" 90 SG$(7)="39" 100 SG$(8)="127" 110 SG$(9)="111" 120 CLS 130 RD=VAL(MID$(TIME$,7,2)) 140 RANDOMIZE RD 150 CONSOLE 0,24,1,0 160 JUST=INT(RND(1)*9+.5) 170 CLS 3 180 OPEN "COM:N81NN" AS #1 190 PRINT #1,"u";:PRINT #1,"0" 200 PRINT #1,"v";:PRINT #1,"0" 210 PRINT #1,"w";:PRINT #1,"0" 220 FOR KAI=1 TO 100 230 FOR I=1 TO 6 240 BEEP 250 FOR DAM=0 TO 100:NEXT DAM 260 LOCATE 10,12:PRINT" スペースキーを押して,サイコロを止めよう!" 270 STP$=INKEY$:IF STP$=" " THEN STP=STP+1 320 PRINT #1,"u";:PRINT #1,SG$(I) 370 IF STP=1 THEN *OWARI 380 NEXT I 390 NEXT KAI 400 *OWARI 410 BEEP 1:FOR TM=1 TO 5000:NEXT TM:BEEP 0 ☆信号機用(対面式信号のシミュレーション) 10 'SAVE"SIGNAL",a 20 CONSOLE 0,24,1,0 30 CLS 3 40 OPEN "COM:N81NN" AS #1 50 PRINT #1,"u";:PRINT #1,"0" 60 PRINT #1,"v";:PRINT #1,"0" 70 PRINT #1,"w";:PRINT #1,"0" 80 L1$="1":GOSUB 250 90 L2$="4":GOSUB 260 100 FOR R=0 TO 10000 110 LOCATE 10,10:PRINT R 120 IF R=8000 THEN L2$="2":GOSUB 260 130 IF R=9000 THEN L2$="1":GOSUB 260 140 NEXT R 150 L1$="4":GOSUB 250 160 FOR R=0 TO 10000 170 LOCATE 10,10:PRINT R 180 IF R=8000 THEN L1$="2":GOSUB 250 190 IF R=9000 THEN L1$="1":GOSUB 250 200 NEXT R 210 L2$="4":GOSUB 260 220 GOTO 100 230 END 240 *LED 250 PRINT #1,"u";:PRINT #1,L1$:RETURN 260 PRINT #1,"v";:PRINT #1,L2$:RETURN 270 PRINT #1,"w";:PRINT #1,L3$:RETURN ☆LED8個ルーレット用(回転速度が遅くなり,ランダムに停止) 10 save"ruletONE",a 20 CLS 30 CONSOLE 0,24,1,0 40 XX=VAL(MID$(TIME$,7,2))) 50 RANDOMIZE XX 60 JUST=INT(RND(1)*8+.5) 70 CLS 3 80 OPEN "COM:N81NN" AS #1 90 PRINT #1,"u";:PRINT #1,"0" 100 FOR KAI=1 TO 10 110 FOR I=0 TO 7 120 BEEP 130 FOR DAM=0 TO 200:NEXT DAM 140 IF KAI>7 THEN FOR DAM=0 TO 1200*(KAI-7):NEXT DAM 150 L$=STR$(2^I):PRINT #1,"u";:PRINT #1,L$:GOTO 230 160 IF KAI>7 THEN FOR DAM=0 TO 1200*(KAI-7):NEXT DAM 180 L$=STR$(2^1):PRINT #1,"u";:PRINT #1,L$:GOTO 230 250 IF KAI=10 THEN IF I=JUST THEN END 260 NEXT I 270 NEXT KAI ☆LED24個ルーレット用(回転速度が遅くなり,ランダムに停止) 10 'save'"rulet2",a 20 CLS 30 CONSOLE 0,24,1,0 40 INPUT"あなたの好きな3桁の数字を入力して下さい。",XX 50 RANDOMIZE XX 60 JUST=INT(RND(1)*23+.5) 70 CLS 3 80 OPEN "COM:N81NN" AS #1 90 PRINT #1,"u";:PRINT #1,"0" 100 PRINT #1,"v";:PRINT #1,"0" 110 PRINT #1,"w";:PRINT #1,"0" 120 FOR KAI=1 TO 10 130 FOR I=0 TO 23 140 BEEP 150 FOR DAM=0 TO 100:NEXT DAM 160 IF KAI>7 THEN FOR DAM=0 TO 800*(KAI-7):NEXT DAM 170 PRINT #1,"w";:PRINT #1,"0" 180 IF I<8 THEN L$=STR$(2^1):PRINT #1,"u";:PRINT #1,L$:GOTO 230 190 PRINT #1,"u";:PRINT #1,"0" 200 IF I<16 THEN L$=STR$(2^(1-8)):PRINT #1,"v";:PRINT #1,L$:GOTO 230 210 PRINT #1,"v";:PRINT #1,"0" 220 L$=STR$(2^(1-16)):PRINT #1,"w";:PRINT #1,L$ 230 LOCATE 10,10:PRINT KAI,I,JUST 240 LOCATE I*2,20:PRINT" *" 250 IF KAI=10 THEN IF I=JUST THEN *OWARI 260 NEXT I 270 NEXT KAI 280 *OWARI 290 BEEP 1:FOR BP=1 TO 9999:NEXT BP:BEEP 0 ☆7セグ用(入力した3桁の数字を表示) 10 'save"SEG1",A 20 SG$(0)="63" 30 SG$(1)="6" 40 SG$(2)="91" 50 SG$(3)="79" 60 SG$(4)="102" 70 SG$(5)="109" 80 SG$(6)="125" 90 SG$(7)="39" 100 SG$(8)="127" 110 SG$(9)="111" 120 CLS 130 CONSOLE 0,24,1,0 140 INPUT"あなたの好きな3桁の数字を入力して下さい。",XX 141 W=INT(XX/100) 142 V=INT(XX/10)-10*W 143 U=XX-100*W-10*V 170 CLS 3 180 OPEN "COM:N81NN" AS #1 190 PRINT #1,"u";:PRINT #1,"0" 200 PRINT #1,"v";:PRINT #1,"0" 210 PRINT #1,"w";:PRINT #1,"0" 211 PRINT #1,"u";:PRINT #1,SG$(W) 212 PRINT #1,"v";:PRINT #1,SG$(V) 213 PRINT #1,"w";:PRINT #1,SG$(U) ☆7セグ用(スロットマシーン風) 10 'save"SEG",A 20 SG$(0)="63" 30 SG$(1)="6" 40 SG$(2)="91" 50 SG$(3)="79" 60 SG$(4)="102" 70 SG$(5)="109" 80 SG$(6)="125" 90 SG$(7)="39" 100 SG$(8)="127" 110 SG$(9)="111" 120 CLS 130 RD=VAL(MID$(TIME$,7,2)) 140 RANDOMIZE RD 150 CONSOLE 0,24,1,0 160 JUST=INT(RND(1)*9+.5) 170 CLS 3 180 OPEN "COM:N81NN" AS #1 190 PRINT #1,"u";:PRINT #1,"0" 200 PRINT #1,"v";:PRINT #1,"0" 210 PRINT #1,"w";:PRINT #1,"0" 220 FOR KAI=1 TO 100 230 FOR I=1 TO 9 240 BEEP 250 FOR DAM=0 TO 100:NEXT DAM 260 LOCATE 10,12:PRINT" スペースキーを3回押して,数字を止めよう!" 270 STP$=INKEY$:IF STP$=" " THEN STP=STP+1 280 IF STP>1 THEN FOR DAM=0 TO 800:NEXT DAM 290 IF STP>0 THEN 310 300 PRINT #1,"w";:PRINT #1,SG$(I) 310 IF STP>1 THEN 310 320 PRINT #1,"u";:PRINT #1,SG$(I) 330 IF STP>2 THEN *OWARI 340 PRINT #1,"v";:PRINT #1,SG$(I) 370 IF STP>1 THEN IF KAI=10 THEN IF I=JUST THEN *OWARI 380 NEXT I 390 NEXT KAI 400 *OWARI 410 BEEP 1:FOR TM=1 TO 5000:NEXT TM:BEEP 0 ※他のBASICに対応させるためのポイント※ 上記プログラムはN88BASIC(NEC)用である。 他の(各社の)BASICに対応させるためには概ね通信回線のオープン命令である。 open "COM:N81NN" as #1(上のプログラムで言えば180行目)を変更すれば良い。
|
|
|
|
連絡先 情報教育課(内線 2500) | |
|
目次へ