标题: [游戏娱乐] 重构批处理俄罗斯方块【完结】 [打印本页]
作者: netbenton 时间: 2021-12-20 16:20 标题: 重构批处理俄罗斯方块【完结】
本帖最后由 netbenton 于 2021-12-29 23:29 编辑
完结了,彩色俄罗斯方块!!!
一、完美计分,
二、升级加速。
三、随着等级上升,速度,加分都有加成。
四、随时切换【经典】和【复杂】玩法。
五、Esc 一键快速关闭。上班摸鱼时老板来了,一键极速消灭证据。
六、养眼的真彩显示,虚化背景方块帮你很好的对齐。消行时有闪烁特效。
七、高分记录前5名,可输入记录者呢称。
八、游戏速度如何?绝对让你满意,单核2.0G以上的CPU就可以畅玩。游戏速度控制得很好,是以时钟控制游戏速度的,
不会因为电脑过快出现速度过快无法玩的情况。电脑越快,cpu占用率会越低。
程序文件连MK.exe一起打包了,共10.3Kb,不能直接贴出来,
压缩后再转码请看这里
mk.exe,在这里可以直接复制代码获得:mk.exe 三方
win10 操作系统测试通过。
终结版本。不再更更新了。
单文件下载。百度网盘:[url=链接:https://pan.baidu.com/s/1x0U6ZqEjFE5KZLuDedqRnQ ] 提取码:bath[/url]
Gif 动图演示:
谢谢!!
作者: zhanglei1371 时间: 2021-12-21 06:25
太强大了!!!!!
作者: qq629926132 时间: 2021-12-21 15:40
真的是太强了, 原来还有那么多花样
作者: netbenton 时间: 2021-12-26 01:01
本帖最后由 netbenton 于 2021-12-26 01:06 编辑
最新、快版本。去掉了注释,变量名减短。可读性差了。
[url=链接:https://pan.baidu.com/s/15gaJrNs-gbKVyjH3X3604w] 提取码:bath[/url]
请看Gif动图。
作者: netbenton 时间: 2021-12-26 14:14
本帖最后由 netbenton 于 2021-12-26 14:16 编辑
精简好了,主程序只有8K。论坛改得只帖子只能发10K了,3方打包不进来。
需要另行下载。
http://bbs.bathome.net/redirect. ... 0771&pid=249351- @echo off
- title 批处理俄罗斯方块
- ::win10测试运行。由netbenton编写,bathome首发,更新于:2021年12月26日
-
- MODE CON: COLS=40 LINES=24
- (FOR /F "TOKENS=1 DELIMS==" %%A IN ('SET') DO SET %%A=
- path %path%
- )
-
- set a=ga1=0 1 5 6;ga2=1 4 5 8;gb1=1 2 4 5;gb2=0 4 5 9;za1=4 5 6 7;za2=1 5 9 d;qa1=1 5 9 8;qa2=0 4 5 6;qa3=2 1 5 9;qa4=4 5 6 a;qb1=1 5 9 a;qb2=2 4 5 6;qb3=0 1 5 9;qb4=4 5 6 8;ta1=5 6 9 a;ta2=5 6 9 a;sa1=1 4 5 6;sa2=1 4 5 9;sa3=4 5 6 9;sa4=1 5 6 9;tw1=5 9;tw2=5 6;on1=9;on2=9;sh1=1 4 5 6 9;sh2=1 4 5 6 9;ao1=0 1 2 4 6;ao2=0 1 4 8 9;ao3=0 4 5 6 2;ao4=0 1 5 8 9;tt1=0 1 2 5 9;tt2=0 4 8 5 6;tt3=1 5 8 9 a;tt4=2 4 5 6 a;k3=k%%=mx,k+;k4=down;k1=y-;k2=y+;k5=暂停;k0=其它键;z=setlocal enabledelayedexpansion;a=!
- set %a:;=&set %
-
- if not exist mk.exe (
- echo;缺少扩展键盘输入的三方【mk.exe】
- pause&goto :eof
- )
-
- for /F "tokens=1 delims=#" %%a in ('"prompt #$E# & echo on & for %%b in (1) do rem"') do set "v=%%a"
- echo;%v%[?25l
-
- for %%a in (1037 1039 13232 1040 11313 12727) do set /a n+=1,k%%a=n
- mk.exe /g
- set/a odt=tt/1000,gmk=0,key1=0,l1=40,l2=120,l3=370,l4=1200,tt=%errorlevel%
-
- %z%
-
- set zmenu=%v%[37m%v%[10;26H 【!a!玩法!a!】%v%[12;26H 第!a!guan!a!关%v%[14;26H 消行:!a!fen!a!%v%[16;26H 【得分】%v%[17;26H !a!fens!a!
-
- call :制表 23 22 zb
-
- set s=a
- for %%a in (b c d e f) do set %%a=!a!!s!!a!&set s=%%a
-
- for /l %%b in (0,1,9) do (
- set gLineText=!gLineText!!b!f!a!d@.%%b!a!!b!
-
- set gLineEcho=!gLineEcho!!c!c!b!d!a!e@!a!.%%b!b!!c!
-
- set pLineTo_0=!pLineTo_0!d@.%%b=0,
-
- )
-
- set pLineTo_0=!pLineTo_0:~,-1!
-
- for /l %%a in (0,1,19) do (
- set e%%a=%%a&set rs=!rs! %%a
- for /f "tokens=*" %%b in ("!pLineTo_0:@=%%a!") do set/a %%b
- set ech=!ech!%v%[B%v%[20D!gLineEcho:@=%%a!
- )
-
- set "rs=!rs! "
-
-
- set n=0
- for /l %%a in (30,1,37) do (
- set c!n!=!v![%%am■
- set f!n!=1
- set /a n+=1
- )
-
-
- for /l %%a in (0,1,3) do (
- set zz=!zz!%v%[B%v%[8D
- for /l %%b in (0,1,3) do (
- set zz=!zz!!b!c!a!k%%a.%%b!a!!b!
- set k%%a.%%b=0
- )
- )
-
- for /l %%a in (0,1,5) do (
- set g#For=!g#For!!c!d!b!e!a!n%%a!a!!b!.!a!m%%a!a!!c!
- set p#To_@=!p#To_@!d!b!e!a!n%%a!a!!b!.!a!m%%a!a!=@,
- set p#To_0=!p#To_0!k!a!n%%a!a!.!a!m%%a!a!=@,
- )
-
-
- set f0=c0= ;zlin=0000000000;简单=sa_4 ta_1 qb_4 qa_4 za_2 ga_2 gb_2;复杂=!a!简单!a! tw_2 on_2 sh_2 ao_4 tt_4;z简单=复杂;z复杂=简单;玩法=简单;f0=0
- set %f0:;=&set %
-
- :rt
-
- %z%
-
- for %%a in (!%玩法%!) do (
- for /f "tokens=1,2 delims=_" %%b in ("%%a") do (
- set _%%b=%%c
- for /l %%d in (1,1,%%c) do (
- set/a nx+=1&set ran!nx!=%%b%%d
- set/a $=0
- set str1=
- for %%e in (!%%b%%d!) do (
- set /a x=0x%%e / 4,y=0x%%e %% 4
- if !x! equ 0 (set x=) else (set x=!x!+)
- if !y! equ 0 (set y=) else (set y=!y!+)
- set str1=!str1!n!$!=!x!x,m!$!=!y!y,
- set /a $+=1
- )
- set %%b%%d=!str1!$=!$!
-
- )
- )
- )
-
- cls
-
- set/a fen=0,guan=1,fens=0
-
- set eev=%ech%
- set eev=%eev%
- set eev=%eev%
-
-
- :l
- set/a "x=-1,t=2,y=3,down=950/(guan*2<<2),bti=0"
- set/a r=!random!%%nx+1,ro=rr,rr=r %% 7+1
- set err=
- set tr=!_tr!
- set _tr=!ran%r%!
- if not defined tr goto :l
-
- set mx=!_%tr:~,2%!
- set k=%tr:~2%
- set str=!%tr%!
- set _str=!%_tr%!
-
- %z%
- set /a x=0,y=0,!_str!,$k=$*13-1
- set p#k=!p#To_0:~,%$k%!
- set /a %p#k:@=rr%
-
-
- for /f "tokens=*" %%a in ("%zz%") do (
- endlocal
- set ekv=%%~a
- )
-
- %z%
- set /a x=0,y=0,!str!,$E=$*23,$P=$*20-1,$k=$*13-1
- set p#k=!p#To_0:~,%$k%!
- set /a %p#k:@=ro%
- for /f "tokens=*" %%a in ("%zz%") do (
-
- endlocal
- set eek=%%~a
- set p#=!p#To_@:~,%$P%!
- set g#=!g#For:~,%$E%!
- set z#=!zlin:~,%$%!
- set p#k=!p#To_0:~,%$k%!
-
- )
-
- set p#=!p#:@=%ro%!
- set "eek=!eek: =%v%[2C!"
-
- echo;%v%[4;36H!ekv!%v%[0m%v%[1;1H!zb!%zmenu%
-
-
- :c
- set /a "tt=tt+9, gmk=gmk %% 5+1",kn=0,tin+=1,ti=tt/10-down
-
- if "!gmk!" neq "5" (
- if !ti! gtr !bti! (
- set/a bti=tt/10,x+=1,!str!
- FOR /F "TOKENS=*" %%A IN ("%g#%") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "!z#!" equ "%%A" (
- set /a x1=x,y1=y*2+11
- set /p =%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!%v%[23;4H空格变形,方向控制,回车暂停,Esc退出。<nul
- ) else (
- goto :j
- )
- )
-
- goto :c
-
- )
-
-
-
- if defined 暂停 (call :p&if defined 暂停 endlocal&set 玩法=!z%玩法%!&goto :rt) else (
-
- mk.exe /g /c !tt! >tt.txt
-
- for /f "tokens=1-5" %%1 in (tt.txt) do (
- set /a kn+=1
- set /a key!kn!=k%%1%%2%%3
- )
-
- for /l %%a in (1,1,!kn!) do (
- for /f %%b in ("!key%%a!") do (
-
- if %%b geq 6 goto :exit
- set bs=!str!
- set/a by=y,bk=k,!k%%b!=1
-
- if "%%b" equ "3" for %%b in ("!tr:~,2!!k!") do set str=!%%~b!
-
- set /a !str!
- FOR /F "TOKENS=*" %%A IN ("%g#%") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "!z#!" equ "%%A" (
- if "%%b" equ "3" (
- %z%
- set /a x=0,y=0,!str!
-
- set /a %p#k:@=ro%
-
-
- for /f "tokens=*" %%a in ("%zz%") do (
- endlocal
- set eek=%%~a
- )
-
- set "eek=!eek: =%v%[2C!"
- )
- set /a x1=x,y1=y*2+11
- echo;%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!
-
- ) else (
-
- set/a y=by,k=bk
- set str=!bs!
- )
- )
-
- )
-
- )
-
- goto :c
-
- :j
- set /a x1=x,y1=y*2+11,x-=1,$=0
- echo;%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!
-
- set /a !str!
-
- for /f "tokens=*" %%a in ("%p#%") do (set /a %%a)
-
- set/a m=0,n=1
- for %%a in (!rs!) do (
- set /a n+=1
- FOR /F "TOKENS=*" %%A IN ("!gLineText:@=%%a!") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "%%A" equ "1111111111" (
- set "rs= %%a!rs: %%a = !"
- set/a m+=1
- set /a "!pLineTo_0:@=%%a!"
- set tx=!tx!!v![!n!;3H■■■■■■■■■■
-
- )
- )
-
-
- if !m! neq 0 (
- set n=0
- for %%a in (!rs!) do (
- set e!n!=%%a
- set /a n+=1,$=n %% 8
- mk /g >nul
- if !$! lss 3 (
- echo;!v![30m!tx!
- ) else (
- echo;!v![3!$!m!tx!
- )
- )
- set tx=
- set/a "fen=fen+m,guan=fen/10+1,fens=fens+l!m!*guan"
- )
-
- set eev=%ech%
- for /l %%a in (1,1,2) do for /f "tokens=*" %%b in ("!eev!") do set eev=%%b
-
- if !x! leq 1 (
- call :记录保存
- endlocal
- goto :rt
- )
-
- goto :l
-
- :记录保存
- echo 游戏结束!
- mk /w /c 3000
- cls
- echo;
- echo;高分排名:
- echo;
- %z%
- for /l %%a in (1,1,5) do set name%%a=无名氏&set zf%%a=0
- set n=0
- for /f "tokens=1,2" %%a in (%~n0.ini) do (
- set /a n+=1
- set name!n!=%%a
- set zf!n!=%%b
- for %%c in (!n!) do echo; %%c !name%%c! !zf%%c!分
- )
- echo;
- echo;
- for /l %%a in (1,1,5) do (
- if not defined find (
- if !fens! gtr !zf%%a! (
- echo;真厉害!本次得分:!fens!分,超过了第%%a名记录保持者:
- echo;【!name%%a!】 !zf%%a! 分
- echo;请留下您的大名:
- set /p name%%a=
- set /a find=zf%%a,zf%%a=fens
- )
- ) else (
- set/a find=zf%%a,zf%%a=!find!
- )
- )
- (
- for /l %%a in (1,1,5) do (
- echo;!name%%a! !zf%%a!
- )
- )>%~n0.ini
-
- endlocal
- goto :eof
-
- :exit
- echo 谢谢使用,再见。。。
- mk /w /c 3000 >nul
- goto :eof
-
-
- :p
-
-
- set /a dt=tt/1000-odt
- set /a zhen=tin/dt
-
- title 【暂停】!zhen!#!down! 按F2切换玩法,其它键继续。。。
- mk /w /c 999999999 >tt.txt
- for /f "tokens=1-5" %%1 in (tt.txt) do set 暂停=%%1%%2%%3
- if !暂停! neq 10113 set 暂停=
-
- title 批处理俄罗斯方块
- goto :eof
-
-
- :制表 宽 高 变量名
- %z%
-
- set/a 宽2=%1-2,高2=%2-2
- set "%3=!%3!!v!(0l!v!H"
- for /l %%a in (1,1,!宽2!) do (
- set %3=!%3!q
- )
- set %3=!%3!k
- for /l %%b in (1,1,!高2!) do (
- set %3=!%3!%v%[1B%v%[%1Dx%v%[!宽2!Cx
- )
- set %3=!%3!%v%[1B%v%[%1Dm
- for /l %%a in (1,1,!宽2!) do (
- set %3=!%3!q
- )
- set "r=!%3!j!v!(B"
- endlocal&set %3=%r%
- goto :eof
复制代码
作者: netbenton 时间: 2021-12-27 14:38
本帖最后由 netbenton 于 2021-12-27 15:40 编辑
增加了背景虚块!!无可挑剔了。。。- @echo off
- title 批处理俄罗斯方块
- ::win10测试运行。由netbenton编写,bathome首发,更新于:2021年12月24日
- MODE CON: COLS=40 LINES=24
- (FOR /F "TOKENS=1 DELIMS==" %%A IN ('SET') DO SET %%A=
- path %path%
- )
-
- set a=ga1=0 1 5 6;ga2=1 4 5 8;gb1=1 2 4 5;gb2=0 4 5 9;za1=4 5 6 7;za2=1 5 9 d;qa1=1 5 9 8;qa2=0 4 5 6;qa3=2 1 5 9;qa4=4 5 6 a;qb1=1 5 9 a;qb2=2 4 5 6;qb3=0 1 5 9;qb4=4 5 6 8;ta1=5 6 9 a;ta2=5 6 9 a;sa1=1 4 5 6;sa2=1 4 5 9;sa3=4 5 6 9;sa4=1 5 6 9;tw1=5 9;tw2=5 6;on1=9;on2=9;sh1=1 4 5 6 9;sh2=1 4 5 6 9;ao1=0 1 2 4 6;ao2=0 1 4 8 9;ao3=0 4 5 6 2;ao4=0 1 5 8 9;tt1=0 1 2 5 9;tt2=0 4 8 5 6;tt3=1 5 8 9 a;tt4=2 4 5 6 a;k3=k%%=mx,k+;k4=down;k1=y-;k2=y+;k5=暂停;k0=其它键;z=setlocal enabledelayedexpansion;a=!
- set %a:;=&set %
-
- if not exist mk.exe (
- echo;缺少扩展键盘输入的三方【mk.exe】
- pause&goto :eof
- )
-
- for /F "tokens=1 delims=#" %%a in ('"prompt #$E# & echo on & for %%b in (1) do rem"') do set "v=%%a"
- echo;%v%[?25l
-
- for %%a in (1037 1039 13232 1040 11313 12727) do set /a n+=1,k%%a=n
- mk.exe /g
- set/a odt=tt/1000,gmk=0,key1=0,l1=40,l2=120,l3=370,l4=1200,tt=%errorlevel%
-
- %z%
-
- set zmenu=%v%[37m%v%[10;26H 【!a!玩法!a!】%v%[12;26H 第!a!guan!a!关%v%[14;26H 消行:!a!fen!a!%v%[16;26H 【得分】%v%[17;26H !a!fens!a!
-
- call :制表 23 22 zb
-
- set s=a
- for %%a in (b c d e f) do set %%a=!a!!s!!a!&set s=%%a
-
- for /l %%b in (0,1,9) do (
- set gLineText=!gLineText!!b!f!a!d@.%%b!a!!b!
-
- set gLineEcho=!gLineEcho!!c!c!b!d!a!e@!a!.%%b!b!!c!
-
- set pLineTo_0=!pLineTo_0!d@.%%b=0,
-
- )
-
- set pLineTo_0=!pLineTo_0:~,-1!
-
- for /l %%a in (0,1,19) do (
- set e%%a=%%a&set rs=!rs! %%a
- for /f "tokens=*" %%b in ("!pLineTo_0:@=%%a!") do set/a %%b
- set ech=!ech!%v%[B%v%[20D!gLineEcho:@=%%a!
- )
-
- set "rs=!rs! "
-
-
- set n=0
- for /l %%a in (30,1,37) do (
- set c!n!=!v![%%am■
- set f!n!=1
- set /a n+=1
- )
-
-
- for /l %%a in (0,1,3) do (
- set zz=!zz!%v%[B%v%[8D
- for /l %%b in (0,1,3) do (
- set zz=!zz!!b!c!a!k%%a.%%b!a!!b!
- set k%%a.%%b=9
- )
- )
-
- for /l %%a in (0,1,5) do (
- set g#For=!g#For!!c!d!b!e!a!n%%a!a!!b!.!a!m%%a!a!!c!
- set p#To_@=!p#To_@!d!b!e!a!n%%a!a!!b!.!a!m%%a!a!=@,
- set p#To_0=!p#To_0!k!a!n%%a!a!.!a!m%%a!a!=@,
- )
-
- set f0=c9=%v%[2C;zlin=0000000000;简单=sa_4 ta_1 qb_4 qa_4 za_2 ga_2 gb_2;复杂=!a!简单!a! tw_2 on_2 sh_2 ao_4 tt_4;z简单=复杂;z复杂=简单;玩法=简单;f0=0
- set %f0:;=&set %
-
- set c0=%v%[38;2;37;37;37m□
- :rt
-
- %z%
-
- for %%a in (!%玩法%!) do (
- for /f "tokens=1,2 delims=_" %%b in ("%%a") do (
- set _%%b=%%c
- for /l %%d in (1,1,%%c) do (
- set/a nx+=1&set ran!nx!=%%b%%d
- set/a $=0
- set str1=
- for %%e in (!%%b%%d!) do (
- set /a x=0x%%e / 4,y=0x%%e %% 4
- if !x! equ 0 (set x=) else (set x=!x!+)
- if !y! equ 0 (set y=) else (set y=!y!+)
- set str1=!str1!n!$!=!x!x,m!$!=!y!y,
- set /a $+=1
- )
- set %%b%%d=!str1!$=!$!
-
- )
- )
- )
-
- cls
-
- set/a fen=0,guan=1,fens=0
-
- set eev=%ech%
- set eev=%eev%
- set eev=%eev%
-
-
- :l
- set/a "x=-1,t=2,y=3,down=950/(guan*2<<2),bti=0"
- set/a r=!random!%%nx+1,ro=rr,rr=r %% 7+1
-
- set tr=!_tr!
- set _tr=!ran%r%!
- if not defined tr goto :l
-
- set mx=!_%tr:~,2%!
- set k=%tr:~2%
- set str=!%tr%!
- set _str=!%_tr%!
- set aan=
-
- %z%
- set /a x=0,y=0,!_str!,$k=$*13-1
- set p#k=!p#To_0:~,%$k%!
- set /a %p#k:@=rr%
-
- set ekv=%zz%
- for /f "tokens=*" %%a in ("!ekv:9=0!") do (
- endlocal
- set ekv=%%~a
- )
-
- %z%
- set /a x=0,y=0,!str!,$E=$*23,$P=$*20-1,$k=$*13-1
- set p#k=!p#To_0:~,%$k%!
- set /a %p#k:@=ro%
- for /f "tokens=*" %%a in ("%zz%") do (
-
- endlocal
- set eek=%%~a
- set p#=!p#To_@:~,%$P%!
- set g#=!g#For:~,%$E%!
- set z#=!zlin:~,%$%!
- set p#k=!p#To_0:~,%$k%!
-
- )
-
- set p#=!p#:@=%ro%!
-
-
- echo;%v%[4;36H!ekv!%v%[0m%v%[1;1H!zb!%zmenu%
-
-
- :c
- set /a "tt=tt+9, gmk=gmk %% 5+1",kn=0,tin+=1,ti=tt/10-down
-
- if "!gmk!" neq "5" (
- if !ti! gtr !bti! (
-
- set/a bti=tt/10,x+=1,!str!
- FOR /F "TOKENS=*" %%A IN ("%g#%") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "!z#!" equ "%%A" (
- set /a x1=x+1,y1=y*2+11
- set /p =%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!%v%[23;4H空格变形,方向控制,回车暂停,Esc退出。<nul
- goto :c
- ) else (
- goto :j
- )
- )
-
- goto :c
-
- )
-
-
-
- if defined 暂停 (call :p&if defined 暂停 endlocal&set 玩法=!z%玩法%!&goto :rt) else (
-
- mk.exe /g /c !tt! >tt.txt
-
- for /f "tokens=1-5" %%1 in (tt.txt) do (
- set /a kn+=1
- set /a key!kn!=k%%1%%2%%3
- )
-
- for /l %%a in (1,1,!kn!) do (
- for /f %%b in ("!key%%a!") do (
-
- if %%b geq 6 goto :exit
- set bs=!str!
- set/a by=y,bk=k,!k%%b!=1
-
- if "%%b" equ "3" for %%b in ("!tr:~,2!!k!") do set str=!%%~b!
-
- set /a !str!
- FOR /F "TOKENS=*" %%A IN ("%g#%") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "!z#!" equ "%%A" (
- if "%%b" equ "3" (
- %z%
- set /a x=0,y=0,!str!
-
- set /a %p#k:@=ro%
- for /f "tokens=*" %%a in ("%zz%") do (
- endlocal
- set eek=%%~a
- )
- )
- set /a x1=x+1,y1=y*2+11
- echo;%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!
-
- ) else (
-
- set/a y=by,k=bk
- set str=!bs!
- )
- )
-
- )
-
- )
-
- goto :c
-
- :j
- set /a x1=x,y1=y*2+11,x-=1,$=0
- echo;%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!
-
- set /a !str!
-
- for /f "tokens=*" %%a in ("%p#%") do (set /a %%a)
-
- set/a m=0,n=1
- for %%a in (!rs!) do (
- set /a n+=1
- FOR /F "TOKENS=*" %%A IN ("!gLineText:@=%%a!") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "%%A" equ "1111111111" (
- set "rs= %%a!rs: %%a = !"
- set/a m+=1
- set /a "!pLineTo_0:@=%%a!"
- set tx=!tx!!v![!n!;3H■■■■■■■■■■
-
- )
- )
-
-
- if !m! neq 0 (
- set n=0
- for %%a in (!rs!) do (
- set e!n!=%%a
- set /a n+=1,$=n %% 8
- mk /g >nul
- if !$! lss 3 (
- echo;!v![30m!tx!
- ) else (
- echo;!v![3!$!m!tx!
- )
- )
- set tx=
- set/a "fen=fen+m,guan=fen/10+1,fens=fens+l!m!*guan"
- )
-
- set eev=%ech%
- for /l %%a in (1,1,2) do for /f "tokens=*" %%b in ("!eev!") do set eev=%%b
-
- if !x! leq 1 (
- call :记录保存
- endlocal
- goto :rt
- )
-
- goto :l
-
- :记录保存
- echo 游戏结束!
- mk /w /c 3000
- cls
- echo;
- echo;高分排名:
- echo;
- %z%
- for /l %%a in (1,1,5) do set name%%a=无名氏&set zf%%a=0
- set n=0
- for /f "tokens=1,2" %%a in (%~n0.ini) do (
- set /a n+=1
- set name!n!=%%a
- set zf!n!=%%b
- for %%c in (!n!) do echo; %%c !name%%c! !zf%%c!分
- )
- echo;
- echo;
- for /l %%a in (1,1,5) do (
- if not defined find (
- if !fens! gtr !zf%%a! (
- echo;真厉害!本次得分:!fens!分,超过了第%%a名记录保持者:
- echo;【!name%%a!】 !zf%%a! 分
- echo;请留下您的大名:
- set /p name%%a=
- set /a find=zf%%a,zf%%a=fens
- )
- ) else (
- set/a find=zf%%a,zf%%a=!find!
- )
- )
- (
- for /l %%a in (1,1,5) do (
- echo;!name%%a! !zf%%a!
- )
- )>%~n0.ini
-
- endlocal
- goto :eof
-
- :exit
- exit
-
-
- :p
-
-
- set /a dt=tt/1000-odt
- set /a zhen=tin/dt
-
- title 【暂停】!zhen!#!down! 按F2切换玩法,其它键继续。。。
- mk /w /c 999999999 >tt.txt
- for /f "tokens=1-5" %%1 in (tt.txt) do set 暂停=%%1%%2%%3
- if !暂停! neq 10113 set 暂停=
-
- title 批处理俄罗斯方块
- goto :eof
-
-
- :制表 宽 高 变量名
- %z%
-
- set/a 宽2=%1-2,高2=%2-2
- set "%3=!%3!!v!(0l!v!H"
- for /l %%a in (1,1,!宽2!) do (
- set %3=!%3!q
- )
- set %3=!%3!k
- for /l %%b in (1,1,!高2!) do (
- set %3=!%3!%v%[1B%v%[%1Dx%v%[!宽2!Cx
- )
- set %3=!%3!%v%[1B%v%[%1Dm
- for /l %%a in (1,1,!宽2!) do (
- set %3=!%3!q
- )
- set "r=!%3!j!v!(B"
- endlocal&set %3=%r%
- goto :eof
复制代码
作者: slimay 时间: 2021-12-27 22:09
bse你值得拥有 ,自动生成 压缩base码 ,从而一次贴到论坛
http://bcn.bathome.net/s/tool/index.html?key=bse
作者: netbenton 时间: 2021-12-27 23:01
为了压缩只有3K的三方,使用一个16K的三方,有点跑远了,我把三方打包进批处理,整个程序俄罗斯方块批处理程序才10.4KB
作者: slimay 时间: 2021-12-28 11:48
本帖最后由 slimay 于 2021-12-28 11:52 编辑
1.该版核心还是09年的老思路 (碰撞检测: set /a x=0x%%e / 4,y=0x%%e %% 4) 貌似也只能这样了,位运算也没有多大性能提升.
2.兼容性不好, win7 64位无法运行.
3.批处理程序才10.4KB, 变换下压缩思路, bse压成 7.2kb, 这个无需携带bse.exe去解压, 所以并没有增加体积, 相反减少了体积.- @echo off
- setlocal enabledelayedexpansion
-
- ::*********BASE64 加权解码器*********
- set $=set [#]&CALL :BASE64_PRESS&set [$]=A&((for %%Z in ([,],{,},_,$,#,-,@) do (set [$]=![$]!![$]!&for %%S in (![$]!) do (for /l %%i in (1,1,7) do (!$!%%i=![#]%%i:%%Z=%%S!))))&for /l %%i in (1,1,7) do (set/p=![#]%%i:.=!<NUL))>a.BSEP&certutil -decode a.BSEP a.zip&pause&exit /b
- ::***********************************
-
- :BASE64_PRESS
-
- !$!1=UEsDBBQ]IAMxcnFMO3HqfzBM[JQp[AF]YS5iYXS9OWtvI0dyn0WA/6Gbu2PvmpQ5M6QoculxdoZvrfiUKIm6DwLJGQ4pPkYiR3x98H9RhByCYD/E8Tq7fu75eYl9thewvTEM5JwEhoEk8IdcEudwdoBU9TxIaWWd4wChdqa7q6uqq+vV1bO3tWbbIEar5fWYHbOnkff+cO+Xv/r2r799+7cfvnL/jYf/7PXcujXpDAT+r/7pg88++/DRo9OzT/92oJkNbWAagxf/4dG9s7uNutk2+toHf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n6q6gQn0hb+yWdefxeuxeIaHLY3UC1PDsw1ODp4G1/f+tIAyHqGTfLVKF5CU3i/8BUEsBAh8AF]AgAzFycUw7cep/MEw[lCk[AUAJ{[g{AGEuYmF0CgAg][ABABgAWqP5XZz71wHtIMddnPvXAa6t7Vyc+9cBUEsFBg]AB[EAVw[AO8T][==
- goto :EOF
复制代码
作者: netbenton 时间: 2021-12-28 22:15
本帖最后由 netbenton 于 2021-12-28 22:51 编辑
回复 9# slimay
你打包的我解压后也不对,也是无法运行,mk.exe 本来只有3.5Kb,经你处理的还原后,变成12K,查了原因是我精简时把一个变量a,放到了解压之前,所以出错了。
压缩后再转码错实变小了,不错!!
彩色处理用的是ansi转义,只有win10才有。
思已经改进了好多了,现在的加上彩色显示后,速度还有所提升,并且只有单窗口。
作者: netbenton 时间: 2021-12-28 23:04
本帖最后由 netbenton 于 2021-12-29 23:24 编辑
回复 9# slimay
压缩后再转码,只有6.7K,方法不错。复制代码
作者: slimay 时间: 2021-12-29 14:28
本帖最后由 slimay 于 2021-12-29 14:31 编辑
回复 11# netbenton
建议给非win10用户, 也留个体验机会. 比如, 你可以增加个开关 ,是否启用彩色显示. set 启用彩色显示=假. 这样我win7也能测了.要不然还得换系统,迁移体验成本太高.
至于体积 ,你压成7z还能更省.虽然论坛限制了附件,但是低于50kb的小文件, 总有一种压缩算法可以控制在 10kb以内
作者: netbenton 时间: 2021-12-29 18:13
回复 12# slimay
好,有空改一版出来。
其实也可以把 mk.exe 加上彩色显示,浮点计算,播放音乐等,那样的话应该达到10Kb
作者: netbenton 时间: 2021-12-29 23:13
回复 12# slimay
想了一下,win xp ,win7 win8 win10 等操作系统的控制台显示都有所不同,很难全部兼顾。不是仅仅是彩色显示的问题,制表符,字符宽,全角,半角等,要考虑的东西太多了。除非针对每一个操作系统做一次排版。
算法上只要尽量用
set /a t!x!.!y!=k!m!.!n!,...
一行代码就完成一个图标数据读写,和碰撞检测,效率就上来了。
win10控制台,以下显示是正常的。在其操作系统却不能很好的对齐。效率实现不难,头痛的是排版问题。
┌─────────────────────┐
│ □□□□□□□□□□│
│ □□□□□□□□□□│
│ □□□□□□□□□□│
│ □□□■■■□□□□│ □■□□
│ □□□□■□□□□□│ ■■■□
│ □□□□□□□□□□│ □□□□
│ □□□□□□□□□□│ □□□□
│ □□□□□□□□□□│
│ □□□□□□□□□□│ 【简单】
│ □□□□□□□□□□│
│ □□□□□□□□□□│ 第1关
│ □□□□□□□□□□│
│ □□□□□□□□□□│ 消行:0
│ □□□□□□□□□□│
│ □□□□□□□□□□│ 【得分】
│ □□□□□□□□□□│ 0
│ □□□□□□□□□□│
│ □□□□□□□□□□│
│ □□□□□□□□□□│
│ □□□□□□□□□□│
└─────────────────────┘
空格变形,方向控制,回车暂停,Esc退出。
作者: hnfeng 时间: 2022-1-13 09:18
好强大,佩服
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |