主题:MOZ版主的贪吃蛇,厉害
DEFLNG A-Z
COLOR 7, 0
CLS
PRINT chr$(218); STRING$(78, 196); chr$(191);
LOCATE 25, 1: PRINT chr$(192); STRING$(78, 196); chr$(217);
FOR i = 2 TO 24
LOCATE i, 1: PRINT chr$(179);
LOCATE i,80: PRINT chr$(179);
NEXT
COLOR 1, 14
LOCATE 12, 30
PRINT " ";
F = 1
E# = .9
s$ = "-12+30-12+31-12+32-12+33-12+34-12+35"
a$ = Getas$(s$)
DO
T1# = TIMER
DO
k$ = INKEY$
LOOP UNTIL k$ <> "" OR ABS(TIMER - T1#) > E#
SELECT CASE k$
CASE CHR$(0) + CHR$(75): IF F <> 3 THEN F = 1
CASE CHR$(0) + CHR$(72): IF F <> 4 THEN F = 2
CASE CHR$(0) + CHR$(77): IF F <> 1 THEN F = 3
CASE CHR$(0) + CHR$(80): IF F <> 2 THEN F = 4
CASE CHR$(27): F = 0
END SELECT
X = VAL(MID$(s$, 2, 2))
y = VAL(MID$(s$, 5, 2))
X2 = X
Y2 = y
SELECT CASE F
CASE 1: Y2 = Y2 - 1
CASE 2: X2 = X2 - 1
CASE 3: Y2 = Y2 + 1
CASE 4: X2 = X2 + 1
END SELECT
z$ = "-" + RIGHT$(STR$(X2), 2) + "+" + RIGHT$(STR$(Y2), 2)
IF X2 < 2 OR X2 > 24 OR Y2 < 2 OR Y2 > 79 OR INSTR(s$, z$) THEN
F = 0
ELSE
COLOR 1, 14
LOCATE X2, Y2
PRINT " ";
IF a$ = z$ THEN
s$ = a$ + s$
a$ = Getas$(z$)
T3 = T3 + 1
IF T3 > 5 THEN
T3 = 0
E# = E# - .1
END IF
ELSE
COLOR 7, 0
LOCATE VAL(RIGHT$(s$, 5)), VAL(RIGHT$(s$, 2))
PRINT " ";
MID$(s$, 1) = z$ + s$
END IF
END IF
LOOP WHILE F
FUNCTION Getas$ (s$)
DO
X = 2 + RND * 22
y = 2 + RND * 77
a$ = "-" + RIGHT$(STR$(X), 2) + "+" + RIGHT$(STR$(y), 2)
LOOP WHILE INSTR(s$, a$)
COLOR 0, 4
LOCATE X, y
PRINT "*";
Getas$ = a$
END FUNCTION