“777”娱乐游戏程序
2、按提示用回车键分别使三个转盘停止转动和再进行一次游戏。
3、每进行一次游戏要花100元;在中间行对出三个一样的图案奖励500元;如对出“777”,就再奖励1500。
4、当你的钱数为“0”时,游戏结束。
语言环境:BASICA、GWBASIC或QuickBASIC。
程序清单如下:
10 DIM A$(9), B$(9), C$(9): X = 10: Y = 32
20 INPUT "Speed:", S: INPUT "Money:", M
30 CLS : RANDOMIZE TIMER: DEF FNA (X) = INT(RND * X): FOR I = 0 TO 9
40 A$(I) = CHR$(FNA(4) + 1): B$(I) = CHR$(FNA(4) + 1): C$(I) = CHR$(FNA(4) + 1)
50 NEXT I: A$(FNA(10)) = "7": B$(FNA(10)) = "7": C$(FNA(10)) = "7"
60 L$ = STRING$(3, 205): M$ = CHR$(186)
70 LOCATE X, Y: PRINT CHR$(201); L$; CHR$(203); L$; CHR$(203); L$; CHR$(187)
80 FOR I = 1 TO 3: IF K$ = " " THEN K$ = "> <" ELSE K$ = " "
90 PRINT TAB(Y); M$; K$; M$; K$; M$; K$; M$: NEXT I
100 PRINT TAB(Y); CHR$(200); L$; CHR$(202); L$; CHR$(202); L$; CHR$(188)
110 M = M - 100: IF M < 0 THEN 240 ELSE T$ = "stop i": GOSUB 220
120 FOR I = 9 TO 1 STEP -1
130 ON K GOTO 150, 160, 200
140 SWAP A$(I), A$(I - 1)
150 SWAP B$(I), B$(I - 1)
160 SWAP C$(I), C$(I - 1): NEXT I: FOR I = 1 TO 3: P = X + I
170 LOCATE P, Y + 2: PRINT A$(I); : LOCATE , Y + 6: PRINT B$(I); : LOCATE , Y + 10: PRINT C$(I)
180 NEXT I: FOR I = 0 TO S: IF INKEY$ = CHR$(13) THEN K = K + 1
185 NEXT I
190 GOTO 120
200 IF A$(2) = B$(2) AND B$(2) = C$(2) THEN M = M + 500: BEEP: IF A$(2) = "7" THEN M = M + 1500: PLAY "L32CECDGAG8"
210 T$ = "restar": GOSUB 220: K$ = INPUT$(1): K = 0: GOTO 110
220 LOCATE X + 7, Y + 1: PRINT "Money="; M; " "
230 PRINT TAB(Y - 4); "Press ENTER to "; T$; "t.": RETURN
240 PRINT TAB(Y - 8); "Now, you have lost all your money."
250 FOR I = 300 TO 100 STEP -3: SOUND I, 1: NEXT I
260 PRINT TAB(Y + 2); "GAME OVER": END
(哈尔滨 孙志岗)