17 楼
小小DAVID [专家分:300] 发布于 2009-11-08 22:06:00
CLS
SCREEN 12
RANDOMIZE TIMER
x = 320: y = 240: z = 1: a = 30: b = 5: n = 45: m = 25: g = 600: h = 30
DIM v(4, 16)
FOR i = 1 TO 16
READ v(1, i)
NEXT i
DATA 30,0,30,-2,30,2,30,0,40,2,50,0,40,-2,30,0
FOR i = 1 TO 16
IF i MOD 2 = 1 THEN v(2, i) = v(1, i + 1): v(2, i + 1) = v(1, i)
v(3, i) = v(1, i)
IF i MOD 2 = 1 THEN v(3, i) = -(v(3, i))
v(4, i) = v(2, i)
IF i MOD 2 = 0 THEN v(4, i) = -(v(4, i))
NEXT i
FOR i = 1 TO 4
FOR j = 1 TO 4
READ p(i, j)
NEXT j, i
DATA -2,2,0,40,0,40,-2,2,-2,2,-40,0,-40,0,-2,2
DO
CIRCLE (a, b), 2, 14
CIRCLE (n, m), 5, 6
CIRCLE (g, h), 5, 6
LINE (x, y)-(x + v(z, 1), y + v(z, 2)), 4
LINE (x + v(z, 3), y + v(z, 4))-(x + v(z, 5), y + v(z, 6)), 4
LINE (x + v(z, 7), y + v(z, 8))-(x + v(z, 9), y + v(z, 10)), 4
LINE -(x + v(z, 11), y + v(z, 12)), 4
LINE -(x + v(z, 13), y + v(z, 14)), 4
LINE -(x + v(z, 15), y + v(z, 16)), 4
IF (a > x - 3 AND a < x + 3) AND (b > y - 3 AND b < y + 3) THEN PRINT "Gryffindor win": FOR i = 1 TO 100000: NEXT i: END
FOR i = 1 TO 100000: NEXT i
CIRCLE (a, b), 2, 0
CIRCLE (n, m), 5, 0
CIRCLE (g, h), 5, 0
LINE (x, y)-(x + v(z, 1), y + v(z, 2)), 0
LINE (x + v(z, 3), y + v(z, 4))-(x + v(z, 5), y + v(z, 6)), 0
LINE (x + v(z, 7), y + v(z, 8))-(x + v(z, 9), y + v(z, 10)), 0
LINE -(x + v(z, 11), y + v(z, 12)), 0
LINE -(x + v(z, 13), y + v(z, 14)), 0
LINE -(x + v(z, 15), y + v(z, 16)), 0
w = INT(RND * 3) - 1: s = INT(RND * 3) - 1
a = a + w * 5: b = b + s * 5
n = n + w * 4: m = m + s * 4
g = g + w * 4: h = h + s * 4
IF a < 0 OR a > 640 OR b < 0 OR b > 480 THEN a = a - w * 5: b = b - s * 5
IF (ABS(a - x) + ABS(b - y)) < (ABS(a - w * 5 - x) + ABS(b - s * 5 - y)) THEN a = a - w * 5: b = b - s * 5
IF (ABS(n - x) + ABS(m - y)) > (ABS(n - w * 4 - x) + ABS(m - s * 4 - y)) THEN n = n - w * 4: m = m - s * 4
IF (ABS(g - x) + ABS(h - y)) > (ABS(g - w * 4 - x) + ABS(h - s * 4 - y)) THEN g = g - w * 4: h = h - s * 4
k$ = INKEY$
q = x + p(z, 3): e = x + p(z, 4): r = y + p(z, 1): t = y + p(z, 2)
IF n > q AND n < e AND m > r AND m < t THEN n = n - w * 4: m = m - s * 4: GOTO 10
IF g > q AND g < e AND h > r AND h < t THEN g = g - w * 4: h = h - s * 4: GOTO 10
IF UCASE$(k$) = "W" THEN z = 2: y = y - 6
IF UCASE$(k$) = "A" THEN z = 1: x = x - 6
IF UCASE$(k$) = "S" THEN z = 4: y = y + 6
IF UCASE$(k$) = "D" THEN z = 3: x = x + 6
IF k$ = CHR$(27) THEN END
10 LOOP
18 楼
zhangyurui2000427 [专家分:80] 发布于 2009-11-20 20:34:00
DECLARE FUNCTION Getas$ (s$)
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