-
-
- @echo off
- goto :sktit
- a
- dw E8A 80 CD89 C581 81 F980 7F05 BA09 1A4 9B4 21CD 5EEB 82BE E800 65 5AE3
- dw 73E8 3C00 7F18 8853 E8C6 57 4CE3 65E8 3C00 7F4F 8845 B0C2 F602 50E2 A0B0
- dw E6F6 15F E8C7 3D 32E3 C387 393C 27E 904 FB80 7E39 8003 9C3 F24 E380 C00F
- dw 4E0 D808 B850 B800 750 295A 89F5 ACE9 88AA AAD0 F9E2 B0 4CB4 21CD ADBA
- dw B401 CD09 EB21 ACF3 203C 475 F9E2 9EB C388 3CAC 7520 E202 C3F9 C387 302C
- dw EB80 B430 F60A E4 C3D8 CEB2 FDCA BBB2 BBB9 B824 CAF1 B2BD B6BB 24D4
-
- r cx
- b6
- n tit.com
- w
- a 100
- db cd 16 c3
-
- r cx
- 3
- n abc.com
- w
- q
- :sktit
- title 批处理扫地雷 之 越战清道夫 Made by netbenton from http://bbs.bathome.net
- set `=!
- if "%1"=="ggbcom" goto :ggbcom
- chcp 437 >nul
- graftabl 936 >nul
- debug <%~nx0>nul
- echo;&echo;&echo 按任意键开始。。。&abc.com
- start /b "" %0 ggbcom
- set #for1=for /f "tokens=1-6" %%c in ("!u! !m! !d! !l! !n! !r!") do (
- set #for2=for %%k in (%%c.%%f %%c.%%g %%c.%%h %%d.%%f %%d.%%h %%e.%%f %%e.%%g %%e.%%h!) do (
- ::这个定义是为了缩减代码和提速
- setlocal enabledelayedexpansion
- set "ec-1= ABCDEFGHIJKLMNOP "
- for /l %%a in (0,1,17) do (set M%%a=!ec-1:~%%a,1!)
- set ec18= !ec-1! 后面还有其它字符表示[插旗]或[取旗]
- set ec-1= !ec-1!
- set ec0=┌────────────────┐
- set ec17=└────────────────┘
- set ec19=
- set str= abcdefghijklmnop
- for /l %%a in (1,1,16) do set com!str:~%%a,1!=%%a
- set ∷=今天运气不错哦。。。
- set ①=生死由命,就放心踩吧
- set ②=这里都不敢动,劝你回家种田吧!
- set ③=团长,要看清想好呀。
- set ④=这里要动的话,就只有半条命了!
- set ⑤=探到不少雷呀,最好不要赌了
- set ⑥=小心呀!团长,想好呀
- set ⑦=危局险啊!最好别动了!
- set ⑧=这里全是雷呀!别动!!!
- set n=0
- for %%a in (① ② ③ ④ ⑤ ⑥ ⑦ ⑧) do (set/a n+=1&set s#=!s#!★&set !s#!=%%a&set n%%a=!n!)
- set over=
- set bj=@
- set bj1=-1
- set bj@1=1
- set say=一个艰巨的任务开始了。。。
- for /l %%a in (0,1,17) do (set r0.%%a=#&set r17.%%a=#&set r%%a.0=#&set r%%a.17=#)
- :begin 重新开始
- cls
- color 2f
- setlocal enabledelayedexpansion
- for /l %%a in (1,1,40) do (
- set/a ran=!random!%%16+1
- set true=
- for /l %%b in (1,1,16) do (
- set/a ram=!random!%%16+1
- if not defined true (
- if not defined L!ran!.!ram! set L!ran!.!ram!=★&set true=y&set/a dilei+=1
- )
- )
- )
- set/a tudi=16*16-dilei
- for /l %%a in (1,1,16) do (
- set/a u=%%a-1,d=%%a+1
- for /l %%b in (1,1,16) do (
- if not defined L%%a.%%b (
- set/a l=%%b-1,r=%%b+1
- for /f "tokens=1-6" %%c in ("!u! %%a !d! !l! %%b !r!") do (
- for %%z in ("!L%%c.%%f!!L%%c.%%g!!L%%c.%%h!!L%%d.%%f!!L%%d.%%h!!L%%e.%%f!!L%%e.%%g!!L%%e.%%h!") do (set r%%a.%%b=!%%~z!)
- )
- )
- )
- )
- for /l %%a in (1,1,16) do (
- for /l %%b in (1,1,16) do (
- if not defined r%%a.%%b set "r%%a.%%b=∷"
- if not defined L%%a.%%b set L%%a.%%b=!r%%a.%%b!
- set r%%a.%%b=
- )
- )
- set benton=set "str=!`!str!`!□"
- :loop 主循环
- cls
- for /l %%a in (1,1,16) do (
- set str=
- for /l %%b in (1,1,16) do (
- if defined r%%a.%%b (
- if !r%%a.%%b! equ @ (set "str=!str!▼") else (set "str=!str!!`!L%%a.%%b!`!")
- ) else (
- %benton%
- )
- )
- set ec%%a=│!str!│
- )
- set benton=set "str=!`!str!`!□"
- :error 出错循环
- cls
- for /l %%a in (-2,1,19) do (for %%b in ("!ec%%a!") do echo; !M%%a!%%~b!M%%a!)
- tit 21 08 2b!over! !say!
- if defined over echo 游戏结束&color 1d&pause&endlocal&goto :begin
- if !tudi! leq 0 echo 恭喜你过关了&color 1e&pause&endlocal&goto :begin
- tit 03 50 2e还有!dilei!个雷,!tudi!亩地
- set /p in= 输入打开点[行前,列后]:
- if "!in!" equ "benton" set benton=set "str=!`!str!`!!`!L%%a.%%b!`!"&goto :loop
- set/a ver=0,m=com!in:~0,1!,n=com!in:~1,1!,ver=m*n
- if !ver! equ 0 goto :error
- set back=:loop
- :zhilp 主动或自动打开地,均使用这个子过程, 与:zhisub子过程和:auto子过程有联合循环动作,即有重入。
- if "!in:~2,1!" neq "" (
- if "!r%m%.%n%:@=!" neq "!r%m%.%n%!" (
- for %%a in (bj!r%m%.%n%!) do (
- set r%m%.%n%=!%%a!
- set/a dilei+=%%a1
- )
- goto %back%
- ) else (
- goto :error
- )
- )
- if defined r%m%.%n% if "!r%m%.%n%!" equ "#" (goto :zhisub) else (goto :error)
- set r%m%.%n%=#
- set/a tudi-=1
- if "!L%m%.%n%!" equ "★" set over= 光荣牺牲了
- if "!L%m%.%n%!" equ "∷" call :auto
- set say=!L%m%.%n%!
- set say=!%say%!
- goto %back% 依靠变量来控制程序走向
- :zhisub 选择点为已经打开的数字时,自动插旗或打开地 的 子过程
- set back=:eof
- set in=
- set/a u=m-1,d=m+1,l=n-1,r=n+1,zh=n!l%m%.%n%!,zh@=0,zhi=0,zh#=0
- %#for1%
- %#for2%
- if defined r%%k (set/a zh!r%%k!+=1) else (set/a zhi+=1)
- )
- )
- set/a zh#=zh@+zhi
- if !zh! equ !zh@! set in=12
- if !zh! equ !zh#! set in=123
- if not defined in goto :error
- %#for1%
- %#for2%
- for /f "tokens=1,2 delims=." %%1 in ("%%k") do (set/a m=%%1,n=%%2)
- if not defined r%%k call :zhilp 循环调用减少代码,增强自动化
- )
- )
- goto :loop
- :auto 打开的为空地时自动打开地 的 子过程
- set/a u=m-1,d=m+1,l=n-1,r=n+1
- %#for1%
- %#for2%
- if not defined r%%k (
- set r%%k=#
- set/a tudi-=1
- if "!L%%k!" equ "∷" (
- for /f "tokens=1,2 delims=." %%1 in ("%%k") do (set/a m=%%1,n=%%2)
- call :auto 循环调用减少代码,增强自动化
- )
- )
- )
- )
- goto :eof
- :ggbcom
- setlocal enabledelayedexpansion
- set sele=批处理之家 扫地雷游戏
- :ggbcomlp
- set sele=!sele:~1!!sele:~,1!
- tit 12 54 2d[%time:~,8%]
- tit 11 48 2d{!sele!}
- ping -n 2 127.1 >nul
- goto :ggbcomlp
复制代码 附tit.com源码:-
-
- ;com/exe程序汇编开发工具,批处理版。版本2.0,(应用实例八)
- ;面向该工具的试验程序,功能:《定点显示,与光标位置无关》
- ;如执行
- ;tit.com 12 34 2f$$$$$
- ;会在12行34列显示字符串$$$$$,颜色为2f
-
- set dos=21
- set 读=3
- set 置=2
- set 显示=10
- set 大于=ng
- set 等于=nz
- set 小于=g
-
- macro $ abc.inc ;包含宏库文件
- ;调用的abc.inc文件内的“参数入口”宏(长度#len.jp,起址#verb.jp)
- $参数入口.abc jp
- a 100 ;程序开始
- mov cl,[#len.jp]
- mov bp,cx
- add bp,81
- if cl 小于 5
- $显示串.abc nop @#str1 ;显示#str1
- jmp #quit.nop ;相当于cmd的goto :eof
- endif
- mov si,#verb.jp
- call ##get
- jcxz #error
- call ##test
- cmp al,18 ;不能大于25行
- jg #error
- mov dh,al
-
- call ##get
- jcxz #error
- call ##test
- cmp al,4f ;不能大于79列
- jg #error
- mov dl,al
-
- mov al,2 ;有一字节为颜色位
- mul dl
- push ax
- mov al,a0 ;每行占50h x 2字节
- mul dh
- pop di
- add di,ax
-
- call ##get ;取颜色到al
- jcxz #error
- xchg ax,bx
- if al 大于 39
- add al,9 ;字母处理
- endif
-
- if bl 大于 39
- add bl,9
- endif
-
- and al,0f
- and bl,0f
- $shl_al.abc nop 4
- or al,bl
-
- push ax
-
- MOV AX,B800
- PUSH AX
- POP ES
-
- pop dx
-
- sub bp,si
- mov cx,bp
-
- #eclp lodsb
- stosb
- mov al,dl
- stosb
- loop #eclp
- $quit.abc nop 0 ;调用退出宏,置返回码为0,返回dos
- ;调用显示串宏
- #error $显示串.abc nop @#str2
- jmp #quit.nop
- ; get子程序定义
- proc get ;检测参数字符是否为:0~9,CX为零出错
- #lp lodsb
- cmp al,20
- jnz #one
- loop #lp
- jmp #err
- #one mov bl,al
- #tow lodsb
- cmp al,20
- jnz #err
- loop #tow
- #err ;错误退出
- endp
-
- ; test子程序定义
- proc test ;把10进制ascii转成机内码16制
- xchg ax,bx
- sub al,30
- sub bl,30
- mov ah,a
- mul ah
- add al,bl
- endp
-
- ;数据段定义
- #str1 db "参数不够!$"
- #str2 db "格式不对!$"
复制代码
|