中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » 解讀“俄羅斯方塊”(已更新)
作者:
标题: 解讀“俄羅斯方塊”(已更新) 上一主题 | 下一主题
bush
银牌会员




积分 2165
发帖 730
注册 2004-4-21
状态 离线
『楼 主』:  解讀“俄羅斯方塊”(已更新)

乾脆傳一份上來算了,發了幾次都被UBB搞坏了.打开附件
“俄羅斯方塊”TC版有註解。如果大家發現有誤,敬請指正。
ZIP文件,大小5.5K

[此贴子已经被作者于2005-1-3 15:41:06编辑过]




2005-1-3 00:00
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
defrag
中级用户

痴迷DOS者


积分 456
发帖 570
注册 2004-10-9
状态 离线
『第 2 楼』:  

再商船各BASIC的:SCREEN 9: WIDTH 40, 25: RANDOMIZE TIMER: TIMER ON
CLEAR , , 10000
DIM a1(4, 4, 4), a(4, 4, 4), o(100, 100): a$ = CHR$(177): x = 3: y = 6: s = 1: s2 = 0: hsc = 10000
FOR l2 = 2 TO 11
o(23, l2) = 1
NEXT
GOSUB r1: CLS : GOSUB r: GOSUB r1
a: k$ = INKEY$
LINE (3, 10)-(93, 180), INT(RND * 15) + 1, B: LINE (4, 11)-(92, 179), INT(RND * 15) + 1, B: LINE (5, 12)-(91, 178), 15, B
IF k$ = CHR$(32) THEN GOSUB c: GOSUB pd2: GOSUB pd: GOSUB h
IF RIGHT$(k$, 1) = CHR$(75) THEN PLAY "t255o4e64": GOSUB c: y = y - 1: fx = 1: GOSUB pd: GOSUB h
IF RIGHT$(k$, 1) = CHR$(77) THEN PLAY "t255o4e64": GOSUB c: y = y + 1: fx = 2: GOSUB pd: GOSUB h
IF RIGHT$(k$, 1) = CHR$(80) THEN PLAY "t255o4e64": GOSUB c: x = x + 1: fx = 3: GOSUB pd: GOSUB h
IF t2 = 0 THEN t = TIMER: t2 = 1
IF TIMER - t >= s THEN GOSUB c: x = x + 1: fx = 3: GOSUB pd: t2 = 0
IF k$ = CHR$(27) THEN STOP
GOSUB h: GOSUB o
GOTO a
pd2: r3 = r3 + 1
IF r3 = 5 THEN r3 = 1
FOR r1 = 1 TO 4
FOR r2 = 1 TO 4
IF a(r1, r2, r3) = 1 AND o(x + r1 - 1, y + r2 - 1) <> 0 AND r3 <> 1 THEN r3 = r3 - 1: GOTO pd22
NEXT: NEXT
pd22: PLAY "t100o4g30"
RETURN
r1: GOSUB sj
LOCATE 12, 25: PRINT "    ": LOCATE 13, 25: PRINT "    ": LOCATE 14, 25: PRINT "    ": LOCATE 15, 25: PRINT "    "
FOR r31 = 1 TO 4
FOR r11 = 1 TO 4
FOR r21 = 1 TO 4
READ a1(r11, r21, r31)
NEXT: NEXT: NEXT
c1 = INT(RND * 9) + 1
r31 = INT(RND * 4) + 1
FOR r1 = 1 TO 4
FOR r2 = 1 TO 4
IF a1(r1, r2, r31) = 1 THEN COLOR c1: LOCATE 11 + r1, 24 + r2: PRINT a$
NEXT: NEXT
COLOR 1: LOCATE 13, 20: PRINT "NEXT:"
RETURN
r:
FOR r3 = 1 TO 4
FOR r1 = 1 TO 4
FOR r2 = 1 TO 4
a(r1, r2, r3) = a1(r1, r2, r3)
NEXT: NEXT: NEXT
c = c1
r3 = r31
RETURN
h:
FOR r1 = 1 TO 4
FOR r2 = 1 TO 4
IF a(r1, r2, r3) = 1 AND y + r2 - 1 > 11 THEN y = 11 - r2 + 1
IF a(r1, r2, r3) = 1 AND y + r2 - 1 < 2 THEN y = 2 - r2 + 1
NEXT: NEXT
FOR r1 = 1 TO 4
FOR r2 = 1 TO 4
IF a(r1, r2, r3) = 1 THEN COLOR c: LOCATE x + r1 - 1, y + r2 - 1: PRINT a$
NEXT: NEXT
RETURN
c:
FOR r1 = 1 TO 4
FOR r2 = 1 TO 4
IF a(r1, r2, r3) = 1 THEN LOCATE x + r1 - 1, y + r2 - 1: PRINT " "
NEXT: NEXT
RETURN
pd:
FOR r1 = 1 TO 4
FOR r2 = 1 TO 4
IF a(r1, r2, r3) = 1 AND o(x + r1 - 1, y + r2 - 1) <> 0 AND fx = 1 THEN y = y + 1
IF a(r1, r2, r3) = 1 AND o(x + r1 - 1, y + r2 - 1) <> 0 AND fx = 2 THEN y = y - 1
IF a(r1, r2, r3) = 1 AND o(x + r1 - 1, y + r2 - 1) <> 0 AND fx = 3 THEN x = x - 1: GOTO f
NEXT: NEXT
RETURN
f:
FOR r1 = 1 TO 4
FOR r2 = 1 TO 4
IF a(r1, r2, r3) = 1 THEN COLOR c: LOCATE x + r1 - 1, y + r2 - 1: PRINT a$: o(x + r1 - 1, y + r2 - 1) = c
IF a(r1, r2, r3) = 1 AND o(3, y) <> 0 THEN COLOR 15: LOCATE 3, 1: PRINT "-GAME  OVER-": PLAY "O3t100g34f34G10f34e34f10e34d34e10d34c34d10c34o2b34o3c1": GOSUB p: SYSTEM
NEXT: NEXT
PLAY "t100o4b30c30": GOSUB k
l1 = 22: l = 0
f2: FOR l2 = 2 TO 11
IF o(l1, l2) <> 0 THEN l = l + 1
NEXT
IF l = 10 THEN GOSUB x: l = 0: li = li + 1: sc = sc + 100 * n
l1 = l1 - 1: l = 0
IF l1 = 2 THEN GOSUB r: GOSUB r1: x = 3: y = 6: n = 0: sc = sc + INT(RND * 30) + 1: GOTO a
GOTO f2
x: FOR l3 = 2 TO 11
COLOR 14: LOCATE l1, l3: PRINT CHR$(15): PLAY "t255o5f64b64": o(l1, l3) = 0
NEXT
x2: FOR l3 = 2 TO 11
IF o(l1, l3) = 0 THEN o(l1, l3) = o(l1 - 1, l3): COLOR o(l1 - 1, l3): LOCATE l1, l3: PRINT a$: o(l1 - 1, l3) = 0
NEXT
l1 = l1 - 1
IF l1 = 2 THEN l1 = 23: PLAY "t100o4g60d60": GOSUB  l4 = 0: n = n + 1: RETURN
GOTO x2

IF li >= 30 THEN s = .9: s2 = 1
IF li >= 60 THEN s = .8: s2 = 2
IF li >= 90 THEN s = .7: s2 = 3
IF li >= 120 THEN s = .6: s2 = 4
IF li >= 150 THEN s = .5: s2 = 5
IF li >= 180 THEN s = .4: s2 = 6
IF li >= 210 THEN s = .3: s2 = 7
IF li >= 240 THEN s = .2: s2 = 8
IF li >= 270 THEN s = .1: s2 = 9
IF sc > hsc THEN hsc = sc
COLOR 15: LOCATE 5, 20: PRINT "SCORE:"; sc: LOCATE 7, 20: PRINT "LINE:"; li: LOCATE 9, 20: PRINT "SPEED:"; s2: COLOR 14: LOCATE 17, 20: PRINT "HISCORE:"; hsc
RETURN
sj: sj = INT(RND * 7) + 1
IF sj = 1 THEN RESTORE 1
IF sj = 2 THEN RESTORE 2
IF sj = 3 THEN RESTORE 3
IF sj = 4 THEN RESTORE 4
IF sj = 4 THEN RESTORE 4
IF sj = 5 THEN RESTORE 5
IF sj = 6 THEN RESTORE 6
IF sj = 7 THEN RESTORE 7
RETURN
1 DATA 1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0, 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0, 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
2 DATA 1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0, 0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0, 0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0
3 DATA 1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0, 0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0, 1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0, 1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0
4 DATA 1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0, 1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0, 1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0, 1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0
5 DATA 1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0, 1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, 0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0, 1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0
6 DATA 0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0, 1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0, 0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0, 1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0
7 DATA 0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0, 0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0, 1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0
8 DATA
p: p$ = INKEY$
IF p$ = CHR$(27) THEN STOP
IF p$ <> "" THEN RETURN
GOTO pk:
FOR k = 1 TO 10000
k$ = INKEY$
NEXT
RETURN



DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青![upload=bmp]uploadImages/20035317345478982.png[/upload]
2005-2-19 00:00
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: