字符炸弹 江苏 庄建国 1994-04-15 在游戏过程中,玩家若想中断游戏,可按〈ESC〉键(按住不放,下同);若要重新选择速度,可按〈SPACE〉键;若要暂停程序运行,可拍一下〈PAUSE〉键(若您使用的键盘上没有该键,可用〈CTRL〉+〈CapsLock〉代替),然后按下除〈PAUSE〉之外的任意键将继续程序运行。 10 KEY OFF: CLS : RANDOMIZE (TIMER) 20 LOCATE 9, 13: PRINT "W e l c o m e t o t h i s P R O G R A M !" 30 LOCATE 10, 13: PRINT "---------------------------------------------" 40 LOCATE 20, 25: PRINT "Press a key to begin..." 50 IF INKEY$ = "" THEN 50 60 INPUT "How many letters"; NUM: IF NUM < 1 THEN 60 70 INPUT "Speed(1-9)"; SP: IF SP > 9 OR SP < 1 THEN 70 80 SPEED = 300 * (10 - SP): M = 1: CLS 90 FOR T = 1 TO 79 100 LOCATE 2, T: PRINT CHR$(1) 110 LOCATE 23, T: PRINT CHR$(2) 120 NEXT T 130 WHILE M <= NUM 140 X = INT(RND * 79) + 1 150 LETTER$ = CHR$(INT(RND * 93) + 33) 160 GOSUB 240 165 M = M + 1 170 WEND 180 MARK = W / NUM * 100: CLS : LOCATE 10, 28: PRINT "GAME OVER!": LOCATE 12, 28 190 IF MARK >= 80 THEN PRINT " GREAT!" ELSE IF MARK >= 60 THEN PRINT "NOT TOO BAD." 210 IF MARK < 60 THEN LOCATE 12, 20: PRINT "Sorry your mark is bad. Practise more!" 220 LOCATE 14, 26: PRINT "Your mark:"; MARK; "%" 230 END 240 FOR Y = 3 TO 23 260 LOCATE Y, X: PRINT LETTER$ 270 FOR L = 1 TO SPEED: NEXT L 280 LOCATE Y, X: PRINT " " 290 IF INKEY$ = LETTER$ THEN GOSUB 350: RETURN 300 IF INKEY$ = CHR$(27) THEN CLS : END 310 IF INKEY$ = CHR$(32) THEN CLS : GOTO 70 320 IF INKEY$ <> "" THEN BEEP 330 NEXT Y 340 RETURN 350 LOCATE Y, X: PRINT LETTER$ 370 FOR H = 22 TO Y + 1 STEP -1 380 LOCATE H, X: PRINT CHR$(24): SOUND (23 - H) * 50, .05 400 LOCATE H, X: PRINT " " 410 NEXT H 420 LOCATE H, X: PRINT CHR$(15): SOUND 400, .1: SOUND 100, .1 440 LOCATE H, X: PRINT " " 450 W = W + 1 460 RETURN