主题:求救:怎样做迷宫
muhuailei
[专家分:0] 发布于 2006-07-31 17:54:00
求救:怎样做迷宫,用搜索再在12模式下line画出来?
高手帮帮啊!!!!!!!!!!
谢。。。。。
回复列表 (共21个回复)
11 楼
Saitor@love.com [专家分:30] 发布于 2009-08-10 12:44:00
[quote]如此
REM L10_15
SCREEN 1
CLS
DATA 1,1,1,1,1,1,1,1,1
DATA 0,0,0,0,0,0,1,0,1
DATA 1,1,0,1,0,1,1,0,1
DATA 1,0,0,1,0,0,0,0,1
DATA 1,1,0,1,0,0,1,0,1
DATA 1,0,0,0,0,1,1,1,1
DATA 1,0,1,1,0,0,0,0,1
DATA 1,0,0,1,1,1,1,0,1
DATA 1,0,0,0,0,0,1,0,0
DATA 1,1,1,1,1,1,1,1,1
x = 10: Y = 9
a$ = STRING$(3, 219)
b$ = STRING$(3, 176)
DIM S(100), x(100), Y(100), a(x, Y): xe = 9: ye = 9
FOR i = 1 TO x: FOR j = 1 TO Y
READ a(i, j)
IF a(i, j) = 1 THEN LOCATE i, j * 3: PRINT a$
NEXT j, i
FOR i = 1 TO 4: FOR j = 1 TO 2
READ v(i, j)
NEXT j, i: DATA 0,1,-1,0,0,-1,1,0
LOCATE 12: PRINT "Press any key to run": d$ = INPUT$(1)
x = 2: Y = 0: p = 0: x(p) = x: Y(p) = Y: i = 0
DO
i = i + 1
IF i <= 4 THEN
x = x(p) + v(i, 1): Y = Y(p) + v(i, 2)
IF a(x, Y) = 0 THEN
p = p + 1: S(p) = i: x(p) = x: Y(p) = Y
a(x, Y) = 2
i = 0
GOSUB 10
END IF
ELSE
GOSUB 10
IF p <> 2 THEN i = S(p)
p = p - 1
END IF
LOOP UNTIL p = 0 OR x = xe AND Y = ye
IF p = 0 THEN
PRINT "NO"
ELSE
LOCATE 14: PRINT "LX:RK"; "2,0"; "--->";
FOR i = 1 TO p
PRINT x(i); ","; Y(i); "--->";
NEXT i: PRINT "CK"
END IF
END
10 LOCATE x(p), Y(p) * 3:
FOR k = 1 TO 300000: NEXT k
IF i <= 4 THEN PRINT USING "##"; p ELSE PRINT b$
RETURN
[/quote]
12 楼
phile [专家分:2310] 发布于 2009-08-10 17:18:00
楼上引用了两遍了!
13 楼
疾疯者L [专家分:100] 发布于 2009-08-17 18:45:00
zhehaoibujiandan hhann
hsjjhhsjakjkki
kiksahuh 这
14 楼
疾疯者L [专家分:100] 发布于 2009-08-17 18:45:00
[quote]zhehaoibujiandan hhann
hsjjhhsjakjkki
kiksahuh 这[/quote]
15 楼
疾疯者L [专家分:100] 发布于 2009-08-17 18:46:00
[quote][quote]如此
REM L10_15
SCREEN 1
CLS
DATA 1,1,1,1,1,1,1,1,1
DATA 0,0,0,0,0,0,1,0,1
DATA 1,1,0,1,0,1,1,0,1
DATA 1,0,0,1,0,0,0,0,1
DATA 1,1,0,1,0,0,1,0,1
DATA 1,0,0,0,0,1,1,1,1
DATA 1,0,1,1,0,0,0,0,1
DATA 1,0,0,1,1,1,1,0,1
DATA 1,0,0,0,0,0,1,0,0
DATA 1,1,1,1,1,1,1,1,1
x = 10: Y = 9
a$ = STRING$(3, 219)
b$ = STRING$(3, 176)
DIM S(100), x(100), Y(100), a(x, Y): xe = 9: ye = 9
FOR i = 1 TO x: FOR j = 1 TO Y
READ a(i, j)
IF a(i, j) = 1 THEN LOCATE i, j * 3: PRINT a$
NEXT j, i
FOR i = 1 TO 4: FOR j = 1 TO 2
READ v(i, j)
NEXT j, i: DATA 0,1,-1,0,0,-1,1,0
LOCATE 12: PRINT "Press any key to run": d$ = INPUT$(1)
x = 2: Y = 0: p = 0: x(p) = x: Y(p) = Y: i = 0
DO
i = i + 1
IF i <= 4 THEN
x = x(p) + v(i, 1): Y = Y(p) + v(i, 2)
IF a(x, Y) = 0 THEN
p = p + 1: S(p) = i: x(p) = x: Y(p) = Y
a(x, Y) = 2
i = 0
GOSUB 10
END IF
ELSE
GOSUB 10
IF p <> 2 THEN i = S(p)
p = p - 1
END IF
LOOP UNTIL p = 0 OR x = xe AND Y = ye
IF p = 0 THEN
PRINT "NO"
ELSE
LOCATE 14: PRINT "LX:RK"; "2,0"; "--->";
FOR i = 1 TO p
PRINT x(i); ","; Y(i); "--->";
NEXT i: PRINT "CK"
END IF
END
10 LOCATE x(p), Y(p) * 3:
FOR k = 1 TO 300000: NEXT k
IF i <= 4 THEN PRINT USING "##"; p ELSE PRINT b$
RETURN
[/quote]
[/quote]
16 楼
天天和和 [专家分:1420] 发布于 2009-08-18 10:05:00
疾疯者L
你别乱回答啊
17 楼
phile [专家分:2310] 发布于 2009-09-05 12:27:00
说得对
18 楼
天天和和 [专家分:1420] 发布于 2009-09-05 16:49:00
无聊啊~
19 楼
phile [专家分:2310] 发布于 2009-09-06 18:52:00
呵呵!
20 楼
天天和和 [专家分:1420] 发布于 2009-09-12 13:55:00
他们是不是无聊在那乱回答啊
我来回复