批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程
[批处理文件精品]批处理版照片整理器[批处理文件精品]纯批处理备份&还原驱动在线第三方下载
返回列表 发帖

[游戏娱乐] 重构批处理俄罗斯方块【完结】

本帖最后由 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 动图演示:



谢谢!!
2

评分人数

    • slimay: 本顿大神终于回归!!!技术 + 1
    • 523066680: 青春又回来了PB + 18 技术 + 1

好强大,佩服

TOP

回复 12# slimay

想了一下,win xp ,win7 win8 win10 等操作系统的控制台显示都有所不同,很难全部兼顾。不是仅仅是彩色显示的问题,制表符,字符宽,全角,半角等,要考虑的东西太多了。除非针对每一个操作系统做一次排版。

算法上只要尽量用   
set /a t!x!.!y!=k!m!.!n!,...  

一行代码就完成一个图标数据读写,和碰撞检测,效率就上来了。

win10控制台,以下显示是正常的。在其操作系统却不能很好的对齐。效率实现不难,头痛的是排版问题。

┌─────────────────────┐
│ □□□□□□□□□□│
│ □□□□□□□□□□│
│ □□□□□□□□□□│
│ □□□■■■□□□□│    □■□□
│ □□□□■□□□□□│    ■■■□
│ □□□□□□□□□□│    □□□□
│ □□□□□□□□□□│    □□□□
│ □□□□□□□□□□│
│ □□□□□□□□□□│   【简单】
│ □□□□□□□□□□│
│ □□□□□□□□□□│    第1关
│ □□□□□□□□□□│
│ □□□□□□□□□□│   消行:0
│ □□□□□□□□□□│
│ □□□□□□□□□□│   【得分】
│ □□□□□□□□□□│   0
│ □□□□□□□□□□│
│ □□□□□□□□□□│
│ □□□□□□□□□□│
│ □□□□□□□□□□│
└─────────────────────┘
   空格变形,方向控制,回车暂停,Esc退出。

TOP

回复 12# slimay

好,有空改一版出来。

其实也可以把 mk.exe 加上彩色显示,浮点计算,播放音乐等,那样的话应该达到10Kb

TOP

本帖最后由 slimay 于 2021-12-29 14:31 编辑

回复 11# netbenton
建议给非win10用户, 也留个体验机会.  比如, 你可以增加个开关 ,是否启用彩色显示. set  启用彩色显示=假.  这样我win7也能测了.要不然还得换系统,迁移体验成本太高.

至于体积 ,你压成7z还能更省.虽然论坛限制了附件,但是低于50kb的小文件, 总有一种压缩算法可以控制在 10kb以内

TOP

本帖最后由 netbenton 于 2021-12-29 23:24 编辑

回复 9# slimay


    压缩后再转码,只有6.7K,方法不错。
  1. @echo off&setlocal enabledelayedexpansion
  2. for /l %%a in (1,1,70) do set /a n+=1&set t=!t!A&set A!n!=!t!
  3. (
  4. for /f "tokens=*" %%a in ('type "%~dpf0"') do (
  5. if "%%a" equ "-----BEGIN CERTIFICATE-----" set a=开始
  6. if defined a echo;%%a
  7. )
  8. )>mk.zip
  9. Certutil -Decode -f "mk.zip" "mk.zip" > nul
  10. endlocal
  11. mk.zip
  12. exit
  13. -----BEGIN CERTIFICATE-----
  14. UEsDBBQAAAAIAJoUnVOylKRfpAsAAAkcAAASAAAAssrJq7btwt7Lube9v+kuYmF0
  15. vRnZbhxF8Nkr7T90jz3Gjsd4jvU5NBiIURBHEOGNB2t2d9ZZZnfG3p2Q3X3gX5YV
  16. iAc/YHBwCAFDwh0glgjmkDiFkADxwI0ISFT1Nbu+OB6w4+7q6qrq6qrq6urJYlg6
  17. nZCkUsnn0mpaC8krv28+/uJ3z3x36ZMrz249v/11PrewcLYaO/ZTX7x57dqVnZ1u
  18. 79034jAthnGaxBuf7Wz21otBejqph2++v/Vob/38HzuX3v2od8G1Xeflbxz32iV3
  19. 9vX38rl7Th5fIrefvHcBmrtPsYJN7r7z3qVTzC3kc2N3nLyfTN1BjAdO3rV07ynm
  20. kONLd995zynGDGKat5I77yVjN5xaeuCGcXL8JAEAsSyfW4WFiYmtmc+N53P5XLVC
  21. 4iQlYavaTEk9ujFshQS36L++8caHEjG6GpxphqNAkyJLM0xJwFYCh9nEIdNkxl8J
  22. XFChAPCcv1J0AHZxBLALNIif9ztAj9AMmQUY6BFLyv4a4AU8B7CinwHYYy7hMwAX
  23. JG/grxUlPYddoJH0RU/qMw+wpAeZKcgHCOkBdjXcxHUlb1PrPw+wJ3g5XAC8gNOz
  24. IIf3XIafxA6bh9aFtnlayyI4cvtGQSLshHrOwAh3iLNzfA50lpQujApiB3wuTRXf
  25. NB8Jy8whLYw8xunErtKCsgKMIo9FpsnqLSua8KMCKydnYz9yWHvSj1zWBtw0u/bx
  26. 2z0/stmrX1754+IffoeBS2tJKaiRMA6KtbAc1oI2tK3VIG5Wk9gPGBV+N4MFn41y
  27. CEOhkjR4GKZJFMZN0Ak4q/UmG8YwDEg1hjA0VhtJfTUlwyNLw2SUiPMTAwTMQFXk
  28. VM44KSekEdaNGziEKxgPMxBi5HM8Hs2HzQdvcadrclkt37G9WQLNPHE813MBLIDZ
  29. HM/xiOPOurNa3FRA4gnmWBFwsjifk8E+tcJ3BrMr9YjZVhS2HehqEK3Qgidd6Dzm
  30. zUJXwJFtpSkzw0YjadTCh8OaaSXllKXplGPbNmpndkx1TDr1MD7DUHVvto6dY/vu
  31. zAnSfYEG9O2vtp6ArrvNJ1w+Qc59BKiVM0EM3bMf8JkCn7l6fWendwGwlRDn+MyM
  32. FHbu8tauFDPLUYKsCR1qAo6tkYXdVze+I65HXJd0ikrBJgs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
  80. narIzwlzW/c40pocaH6pZy1nv9Sz2h+I8UujkcVRT5j3eiQpIvMLRT5KJT4g8eOm
  81. OflwxCeWtGpV3Mfo0fnWjpnzaq8UNfL1XXeKpoHesfVu0QLQMwJeP/p/XNshEGLn
  82. Coi1RcrT6LtP2nAtOHNLgtnGAiesIJB5dirdNuF5kfKauPOggEkr++Q1qjxV8MDk
  83. N9BP+pbI4koZtN1sbKgI992khbsk6vPIcDNbOOPsJuDi7/Oq4FOipxG1J4jBRl7L
  84. Jnkp8p/+SZqZeKGcyrnPCjlEahJGKdGQ21uckvkKXn4/VRMYaAfgeUUv+gZBERjv
  85. 06onIeTqTrIGWbcmWIweiXhLdWK+TU1jm7NCloUFS7mQo80A4mhiShmk3KjoJbdV
  86. 4lZudbESz3K0cLc2xZp+gOEOELrZJPRkaGq3p+5ES6LiE+BQrxQYh8nMds4KvlOv
  87. Ad7pnl5Fgm/V02j7wN4kZB1aGXrVPeCr3a5pWm8hq5yzNrr3g1t99lnTHEkho03J
  88. KPEMoe2UytmD4SmQzfWvYbH6qyBKUzvR518Dtt8NlkYz6kso9I8AoL4wgbscrYdo
  89. jUbrJlpjsMiNcBks1SIlt3YkzZMBg2INx31NcOgJg5TKabg6ba3RbNLsArveDnen
  90. laHb2PcH6F0/HLxtDnbD4jUfB0e7r/k4ckVnvddaiMMKWBHk9JXyh2oP1xCEy8k5
  91. gv39hDX1YdN92PQBzsUGvdzJYhNA1lTiMWmZvokajoXU4wR3DB03YFE1FJWzQKx5
  92. kFPnAUzfSS9LRyrLsXbg97X9vs+2YfZzNUJAjU5XVI5my5WmytkZaGv1HQdb0q8j
  93. XaWqgPTQ8mbqKCzCJs85MB753UOgfwPmu/RjOsH19ZQX2F1in5r5rgXGRF91lqZg
  94. BK5qZfjduDYJqiPIbRJeNM7JaihS4iqhzTR6tcZVd7I0tSgB4aTwWIEZHaR8NFGL
  95. Em8g1JSOQeQDRO6Dfgf6jkYbksJNjeaSwo10JG1XsiY6GCtagM+lfOSgaDQkNxhF
  96. r/WiTL5oVLqjki2kbX9MSvcMmtUMHL/Jhq/j4JbBF90kchj/+ukNjUJzWOW+Rh/7
  97. ++MQ+jF6DKLKqa4M6Be5AzxBDu5GYZfP1d+DqYdL06hFn7Wt+hRYwZE0T8iPdt2J
  98. QnxEZzshoHrwqZ0Dl+wCtCBY7Hr/aGOPNenBBScnPHzlWoC5Wl/CV4EsZNLCZEsm
  99. rUy2Z7ITk12Z5Jnsw+QAJgcyOQzkRUYJe5/CRHUfi3NWrQZ0lMP/+zNtDna1jOpq
  100. pcPX3ZYH5WF/gN3zsBPANnnYfN1temq+64QFfguY+hvpAA/vSMA3gJ8CvwMugneB
  101. LsAlwFXAE4Grgd3ASKsMvZLP9wmhD/Deb3zrwTeM//XrbiPCyoDsiEa8YixGnpIJ
  102. ojw2Eg57JJ89IIljyGvdI8UiIXEKvG/iuILHKfsmQk4I8CbE1QHvkrERKsHrVHeT
  103. QxSXGCWTpKVUHkOGmWaIHt/3Psnk/KHzIZMzJIpLyXvT7GhAFscHoH2bglBMjno9
  104. UEA6MzskSmAvEaOSGCodWuILhQiJm1bElkYDkrxoDKExMWr4/zAdq7u2Y//l8592
  105. HnHZVvC2GG9bPI932bwowiAkGp4H7419ffw3n1bFxLaC2GLEtpjYvMQWJv/pL6Uv
  106. UEsBAj8AF!A5!gAmhSdU7KUpF+kCwAACRwAABIAJ!A10!g!A9!LLK
  107. yau27cLey7m3vb/pLmJhdAoAI!A8!QAYAP6LdOAZ/NcBvOvRPsf81wGure1c
  108. nPvXAVBLAQI/ABQAAAAIADm1nFMGT7CQSAUAAAAOAAAGACQ!A9!IAAAANQL
  109. AABtay5leGUKAC!A8!EAGAB+dAQL+fvXAetlTnfH/NcB2Yj4Cvn71wFQSwUG
  110. !A6!IAAgC8AAAAQBE!A5!
  111. -----END CERTIFICATE-----
复制代码

TOP

本帖最后由 netbenton 于 2021-12-28 22:51 编辑

回复 9# slimay

你打包的我解压后也不对,也是无法运行,mk.exe 本来只有3.5Kb,经你处理的还原后,变成12K,查了原因是我精简时把一个变量a,放到了解压之前,所以出错了。

压缩后再转码错实变小了,不错!!

彩色处理用的是ansi转义,只有win10才有。

思已经改进了好多了,现在的加上彩色显示后,速度还有所提升,并且只有单窗口。

TOP

本帖最后由 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去解压, 所以并没有增加体积, 相反减少了体积.
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. ::*********BASE64 加权解码器*********
  4. 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
  5. ::***********************************
  6. :BASE64_PRESS
  7. !$!1=UEsDBBQ]IAMxcnFMO3HqfzBM[JQp[AF]YS5iYXS9OWtvI0dyn0WA/6Gbu2PvmpQ5M6QoculxdoZvrfiUKIm6DwLJGQ4pPkYiR3x98H9RhByCYD/E8Tq7fu75eYl9thewvTEM5JwEhoEk8IdcEudwdoBU9TxIaWWd4wChdqa7q6uqq+vV1bO3tWbbIEar5fWYHbOnkff+cO+Xv/r2r799+7cfvnL/jYf/7PXcujXpDAT+r/7pg88++/DRo9OzT/92oJkNbWAagxf/4dG9s7uNutk2+toHf3f/T8/uPvjh0duffnn2qsiLwrv/IoifvS2u/83nXk++mEyRRLFwC16bW1KYJ5u5QmpLEsNez410sUKCaeLbLt5JFbYkgSRTm7n8liT5CMfJJFcgN57eSm0/fZMkiwQ6CJW8niNYmHD45ryem16P1zPSTFKX9Log8UQgay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XAa6t7Vyc+9cBUEsFBg]AB[EAVw[AO8T][==
  14. goto :EOF
复制代码

TOP

为了压缩只有3K的三方,使用一个16K的三方,有点跑远了,我把三方打包进批处理,整个程序俄罗斯方块批处理程序才10.4KB

TOP

bse你值得拥有 ,自动生成 压缩base码 ,从而一次贴到论坛
http://bcn.bathome.net/s/tool/index.html?key=bse

TOP

本帖最后由 netbenton 于 2021-12-27 15:40 编辑

增加了背景虚块!!无可挑剔了。。。
  1. @echo off
  2. title 批处理俄罗斯方块
  3. ::win10测试运行。由netbenton编写,bathome首发,更新于:2021年12月24日
  4. MODE CON: COLS=40 LINES=24
  5. (FOR /F "TOKENS=1 DELIMS==" %%A IN ('SET') DO SET %%A=
  6. path %path%
  7. )
  8. 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=!
  9. set %a:;=&set %
  10. if not exist mk.exe (
  11. echo;缺少扩展键盘输入的三方【mk.exe】
  12. pause&goto :eof
  13. )
  14. for /F "tokens=1 delims=#" %%a in ('"prompt #$E# & echo on & for %%b in (1) do rem"') do set "v=%%a"
  15. echo;%v%[?25l
  16. for %%a in (1037 1039 13232 1040 11313 12727) do set /a n+=1,k%%a=n
  17. mk.exe /g
  18. set/a odt=tt/1000,gmk=0,key1=0,l1=40,l2=120,l3=370,l4=1200,tt=%errorlevel%
  19. %z%
  20. 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!
  21. call :制表 23 22 zb
  22. set s=a
  23. for %%a in (b c d e f) do set %%a=!a!!s!!a!&set s=%%a
  24. for /l %%b in (0,1,9) do (
  25. set gLineText=!gLineText!!b!f!a!d@.%%b!a!!b!
  26. set gLineEcho=!gLineEcho!!c!c!b!d!a!e@!a!.%%b!b!!c!
  27. set pLineTo_0=!pLineTo_0!d@.%%b=0,
  28. )
  29. set pLineTo_0=!pLineTo_0:~,-1!
  30. for /l %%a in (0,1,19) do (
  31. set e%%a=%%a&set rs=!rs! %%a
  32. for /f "tokens=*" %%b in ("!pLineTo_0:@=%%a!") do set/a %%b
  33. set ech=!ech!%v%[B%v%[20D!gLineEcho:@=%%a!
  34. )
  35. set "rs=!rs! "
  36. set n=0
  37. for /l %%a in (30,1,37) do (
  38. set c!n!=!v![%%am■
  39. set f!n!=1
  40. set /a n+=1
  41. )
  42. for /l %%a in (0,1,3) do (
  43. set zz=!zz!%v%[B%v%[8D
  44. for /l %%b in (0,1,3) do (
  45. set zz=!zz!!b!c!a!k%%a.%%b!a!!b!
  46. set k%%a.%%b=9
  47. )
  48. )
  49. for /l %%a in (0,1,5) do (
  50. set g#For=!g#For!!c!d!b!e!a!n%%a!a!!b!.!a!m%%a!a!!c!
  51. set p#To_@=!p#To_@!d!b!e!a!n%%a!a!!b!.!a!m%%a!a!=@,
  52. set p#To_0=!p#To_0!k!a!n%%a!a!.!a!m%%a!a!=@,
  53. )
  54. 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
  55. set %f0:;=&set %
  56. set c0=%v%[38;2;37;37;37m□
  57. :rt
  58. %z%
  59. for %%a in (!%玩法%!) do (
  60. for /f "tokens=1,2 delims=_" %%b in ("%%a") do (
  61.   set _%%b=%%c
  62.   for /l %%d in (1,1,%%c) do (
  63. set/a nx+=1&set ran!nx!=%%b%%d
  64. set/a $=0
  65. set str1=
  66. for %%e in (!%%b%%d!) do (
  67. set /a x=0x%%e / 4,y=0x%%e %% 4
  68. if !x! equ 0 (set x=) else (set x=!x!+)
  69. if !y! equ 0 (set y=) else (set y=!y!+)
  70. set str1=!str1!n!$!=!x!x,m!$!=!y!y,
  71. set /a $+=1
  72. )
  73. set %%b%%d=!str1!$=!$!
  74.   )
  75. )
  76. )
  77. cls
  78. set/a fen=0,guan=1,fens=0
  79. set eev=%ech%
  80. set eev=%eev%
  81. set eev=%eev%
  82. :l
  83. set/a "x=-1,t=2,y=3,down=950/(guan*2<<2),bti=0"
  84. set/a r=!random!%%nx+1,ro=rr,rr=r %% 7+1
  85. set tr=!_tr!
  86. set _tr=!ran%r%!
  87. if not defined tr goto :l
  88. set mx=!_%tr:~,2%!
  89. set k=%tr:~2%
  90. set str=!%tr%!
  91. set _str=!%_tr%!
  92. set aan=
  93. %z%
  94. set /a x=0,y=0,!_str!,$k=$*13-1
  95. set p#k=!p#To_0:~,%$k%!
  96. set /a %p#k:@=rr%
  97. set  ekv=%zz%
  98. for /f "tokens=*" %%a in ("!ekv:9=0!") do (
  99. endlocal
  100. set ekv=%%~a
  101. )
  102. %z%
  103. set /a x=0,y=0,!str!,$E=$*23,$P=$*20-1,$k=$*13-1
  104. set p#k=!p#To_0:~,%$k%!
  105. set /a %p#k:@=ro%
  106. for /f "tokens=*" %%a in ("%zz%") do (
  107. endlocal
  108. set eek=%%~a
  109. set p#=!p#To_@:~,%$P%!
  110. set g#=!g#For:~,%$E%!
  111. set z#=!zlin:~,%$%!
  112. set p#k=!p#To_0:~,%$k%!
  113. )
  114. set p#=!p#:@=%ro%!
  115. echo;%v%[4;36H!ekv!%v%[0m%v%[1;1H!zb!%zmenu%
  116. :c
  117. set /a "tt=tt+9, gmk=gmk %% 5+1",kn=0,tin+=1,ti=tt/10-down
  118. if "!gmk!" neq "5" (
  119. if !ti! gtr !bti! (
  120. set/a bti=tt/10,x+=1,!str!
  121. FOR /F "TOKENS=*" %%A IN ("%g#%") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "!z#!" equ "%%A" (
  122. set /a x1=x+1,y1=y*2+11
  123. set /p =%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!%v%[23;4H空格变形,方向控制,回车暂停,Esc退出。<nul
  124. goto :c
  125. ) else (
  126. goto :j
  127. )
  128. )
  129. goto :c
  130. )
  131. if defined 暂停 (call :p&if defined 暂停 endlocal&set 玩法=!z%玩法%!&goto :rt) else (
  132. mk.exe /g /c !tt! >tt.txt
  133. for /f "tokens=1-5" %%1 in (tt.txt) do (
  134. set /a kn+=1
  135.    set /a key!kn!=k%%1%%2%%3
  136. )
  137. for /l %%a in (1,1,!kn!) do (
  138. for /f %%b in ("!key%%a!") do (
  139. if %%b geq 6 goto :exit
  140. set bs=!str!
  141. set/a by=y,bk=k,!k%%b!=1
  142. if "%%b" equ "3" for %%b in ("!tr:~,2!!k!") do set str=!%%~b!
  143. set /a !str!
  144. FOR /F "TOKENS=*" %%A IN ("%g#%") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "!z#!" equ "%%A" (
  145. if "%%b" equ "3" (
  146. %z%
  147. set /a x=0,y=0,!str!
  148. set /a %p#k:@=ro%
  149. for /f "tokens=*" %%a in ("%zz%") do (
  150. endlocal
  151. set eek=%%~a
  152. )
  153. )
  154. set /a x1=x+1,y1=y*2+11
  155. echo;%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!
  156. ) else (
  157. set/a y=by,k=bk
  158. set str=!bs!
  159. )
  160. )
  161. )
  162. )
  163. goto :c
  164. :j
  165. set /a x1=x,y1=y*2+11,x-=1,$=0
  166. echo;%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!
  167. set /a !str!
  168. for /f "tokens=*" %%a in ("%p#%") do (set /a %%a)
  169. set/a m=0,n=1
  170. for %%a in (!rs!) do (
  171. set /a n+=1
  172. FOR /F "TOKENS=*" %%A IN ("!gLineText:@=%%a!") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "%%A" equ "1111111111" (
  173. set "rs= %%a!rs: %%a = !"
  174. set/a m+=1
  175. set /a "!pLineTo_0:@=%%a!"
  176. set  tx=!tx!!v![!n!;3H■■■■■■■■■■
  177. )
  178. )
  179. if !m! neq 0 (
  180. set n=0
  181. for %%a in (!rs!) do (
  182. set e!n!=%%a
  183. set /a n+=1,$=n %% 8
  184. mk /g >nul
  185. if !$! lss 3 (
  186. echo;!v![30m!tx!
  187. ) else (
  188. echo;!v![3!$!m!tx!
  189. )
  190. )
  191. set tx=
  192. set/a "fen=fen+m,guan=fen/10+1,fens=fens+l!m!*guan"
  193. )
  194. set eev=%ech%
  195. for /l %%a in (1,1,2) do for /f "tokens=*" %%b in ("!eev!") do set eev=%%b
  196. if !x! leq 1 (
  197. call :记录保存
  198. endlocal
  199. goto :rt
  200. )
  201. goto :l
  202. :记录保存
  203. echo 游戏结束!
  204. mk /w /c 3000
  205. cls
  206. echo;
  207. echo;高分排名:
  208. echo;
  209. %z%
  210. for /l %%a in (1,1,5) do set name%%a=无名氏&set zf%%a=0
  211. set n=0
  212. for /f "tokens=1,2" %%a in (%~n0.ini) do (
  213. set /a n+=1
  214. set name!n!=%%a
  215. set zf!n!=%%b
  216. for %%c in (!n!) do echo; %%c !name%%c! !zf%%c!分
  217. )
  218. echo;
  219. echo;
  220. for /l %%a in (1,1,5) do (
  221.     if not defined find (
  222.           if !fens! gtr !zf%%a! (
  223. echo;真厉害!本次得分:!fens!分,超过了第%%a名记录保持者:
  224. echo;【!name%%a!】 !zf%%a! 分
  225. echo;请留下您的大名:
  226. set /p name%%a=
  227. set /a find=zf%%a,zf%%a=fens
  228.          )
  229.     ) else (
  230.          set/a find=zf%%a,zf%%a=!find!
  231.     )
  232. )
  233. (
  234. for /l %%a in (1,1,5) do (
  235. echo;!name%%a! !zf%%a!
  236. )
  237. )>%~n0.ini
  238. endlocal
  239. goto :eof
  240. :exit
  241. exit
  242. :p
  243. set /a dt=tt/1000-odt
  244. set /a zhen=tin/dt
  245. title 【暂停】!zhen!#!down! 按F2切换玩法,其它键继续。。。
  246. mk /w /c 999999999 >tt.txt
  247. for /f "tokens=1-5" %%1 in (tt.txt) do set 暂停=%%1%%2%%3
  248. if !暂停! neq 10113 set 暂停=
  249. title 批处理俄罗斯方块
  250. goto :eof
  251. :制表 宽 高 变量名
  252. %z%
  253. set/a 宽2=%1-2,高2=%2-2
  254. set "%3=!%3!!v!(0l!v!H"
  255. for /l %%a in (1,1,!宽2!) do (
  256.    set %3=!%3!q
  257. )
  258. set %3=!%3!k
  259. for /l %%b in (1,1,!高2!) do (
  260.    set %3=!%3!%v%[1B%v%[%1Dx%v%[!宽2!Cx
  261. )
  262. set %3=!%3!%v%[1B%v%[%1Dm
  263. for /l %%a in (1,1,!宽2!) do (
  264.    set %3=!%3!q
  265. )
  266. set "r=!%3!j!v!(B"
  267. endlocal&set %3=%r%
  268. goto :eof
复制代码

TOP

本帖最后由 netbenton 于 2021-12-26 14:16 编辑

精简好了,主程序只有8K。论坛改得只帖子只能发10K了,3方打包不进来。

需要另行下载。
http://bbs.bathome.net/redirect. ... 0771&pid=249351
  1. @echo off
  2. title 批处理俄罗斯方块
  3. ::win10测试运行。由netbenton编写,bathome首发,更新于:2021年12月26日
  4. MODE CON: COLS=40 LINES=24
  5. (FOR /F "TOKENS=1 DELIMS==" %%A IN ('SET') DO SET %%A=
  6. path %path%
  7. )
  8. 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=!
  9. set %a:;=&set %
  10. if not exist mk.exe (
  11. echo;缺少扩展键盘输入的三方【mk.exe】
  12. pause&goto :eof
  13. )
  14. for /F "tokens=1 delims=#" %%a in ('"prompt #$E# & echo on & for %%b in (1) do rem"') do set "v=%%a"
  15. echo;%v%[?25l
  16. for %%a in (1037 1039 13232 1040 11313 12727) do set /a n+=1,k%%a=n
  17. mk.exe /g
  18. set/a odt=tt/1000,gmk=0,key1=0,l1=40,l2=120,l3=370,l4=1200,tt=%errorlevel%
  19. %z%
  20. 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!
  21. call :制表 23 22 zb
  22. set s=a
  23. for %%a in (b c d e f) do set %%a=!a!!s!!a!&set s=%%a
  24. for /l %%b in (0,1,9) do (
  25. set gLineText=!gLineText!!b!f!a!d@.%%b!a!!b!
  26. set gLineEcho=!gLineEcho!!c!c!b!d!a!e@!a!.%%b!b!!c!
  27. set pLineTo_0=!pLineTo_0!d@.%%b=0,
  28. )
  29. set pLineTo_0=!pLineTo_0:~,-1!
  30. for /l %%a in (0,1,19) do (
  31. set e%%a=%%a&set rs=!rs! %%a
  32. for /f "tokens=*" %%b in ("!pLineTo_0:@=%%a!") do set/a %%b
  33. set ech=!ech!%v%[B%v%[20D!gLineEcho:@=%%a!
  34. )
  35. set "rs=!rs! "
  36. set n=0
  37. for /l %%a in (30,1,37) do (
  38. set c!n!=!v![%%am■
  39. set f!n!=1
  40. set /a n+=1
  41. )
  42. for /l %%a in (0,1,3) do (
  43. set zz=!zz!%v%[B%v%[8D
  44. for /l %%b in (0,1,3) do (
  45. set zz=!zz!!b!c!a!k%%a.%%b!a!!b!
  46. set k%%a.%%b=0
  47. )
  48. )
  49. for /l %%a in (0,1,5) do (
  50. set g#For=!g#For!!c!d!b!e!a!n%%a!a!!b!.!a!m%%a!a!!c!
  51. set p#To_@=!p#To_@!d!b!e!a!n%%a!a!!b!.!a!m%%a!a!=@,
  52. set p#To_0=!p#To_0!k!a!n%%a!a!.!a!m%%a!a!=@,
  53. )
  54. 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
  55. set %f0:;=&set %
  56. :rt
  57. %z%
  58. for %%a in (!%玩法%!) do (
  59. for /f "tokens=1,2 delims=_" %%b in ("%%a") do (
  60.   set _%%b=%%c
  61.   for /l %%d in (1,1,%%c) do (
  62. set/a nx+=1&set ran!nx!=%%b%%d
  63. set/a $=0
  64. set str1=
  65. for %%e in (!%%b%%d!) do (
  66. set /a x=0x%%e / 4,y=0x%%e %% 4
  67. if !x! equ 0 (set x=) else (set x=!x!+)
  68. if !y! equ 0 (set y=) else (set y=!y!+)
  69. set str1=!str1!n!$!=!x!x,m!$!=!y!y,
  70. set /a $+=1
  71. )
  72. set %%b%%d=!str1!$=!$!
  73.   )
  74. )
  75. )
  76. cls
  77. set/a fen=0,guan=1,fens=0
  78. set eev=%ech%
  79. set eev=%eev%
  80. set eev=%eev%
  81. :l
  82. set/a "x=-1,t=2,y=3,down=950/(guan*2<<2),bti=0"
  83. set/a r=!random!%%nx+1,ro=rr,rr=r %% 7+1
  84. set err=
  85. set tr=!_tr!
  86. set _tr=!ran%r%!
  87. if not defined tr goto :l
  88. set mx=!_%tr:~,2%!
  89. set k=%tr:~2%
  90. set str=!%tr%!
  91. set _str=!%_tr%!
  92. %z%
  93. set /a x=0,y=0,!_str!,$k=$*13-1
  94. set p#k=!p#To_0:~,%$k%!
  95. set /a %p#k:@=rr%
  96. for /f "tokens=*" %%a in ("%zz%") do (
  97. endlocal
  98. set ekv=%%~a
  99. )
  100. %z%
  101. set /a x=0,y=0,!str!,$E=$*23,$P=$*20-1,$k=$*13-1
  102. set p#k=!p#To_0:~,%$k%!
  103. set /a %p#k:@=ro%
  104. for /f "tokens=*" %%a in ("%zz%") do (
  105. endlocal
  106. set eek=%%~a
  107. set p#=!p#To_@:~,%$P%!
  108. set g#=!g#For:~,%$E%!
  109. set z#=!zlin:~,%$%!
  110. set p#k=!p#To_0:~,%$k%!
  111. )
  112. set p#=!p#:@=%ro%!
  113. set "eek=!eek: =%v%[2C!"
  114. echo;%v%[4;36H!ekv!%v%[0m%v%[1;1H!zb!%zmenu%
  115. :c
  116. set /a "tt=tt+9, gmk=gmk %% 5+1",kn=0,tin+=1,ti=tt/10-down
  117. if "!gmk!" neq "5" (
  118. if !ti! gtr !bti! (
  119. set/a bti=tt/10,x+=1,!str!
  120. FOR /F "TOKENS=*" %%A IN ("%g#%") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "!z#!" equ "%%A" (
  121. set /a x1=x,y1=y*2+11
  122. set /p =%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!%v%[23;4H空格变形,方向控制,回车暂停,Esc退出。<nul
  123. ) else (
  124. goto :j
  125. )
  126. )
  127. goto :c
  128. )
  129. if defined 暂停 (call :p&if defined 暂停 endlocal&set 玩法=!z%玩法%!&goto :rt) else (
  130. mk.exe /g /c !tt! >tt.txt
  131. for /f "tokens=1-5" %%1 in (tt.txt) do (
  132. set /a kn+=1
  133.    set /a key!kn!=k%%1%%2%%3
  134. )
  135. for /l %%a in (1,1,!kn!) do (
  136. for /f %%b in ("!key%%a!") do (
  137. if %%b geq 6 goto :exit
  138. set bs=!str!
  139. set/a by=y,bk=k,!k%%b!=1
  140. if "%%b" equ "3" for %%b in ("!tr:~,2!!k!") do set str=!%%~b!
  141. set /a !str!
  142. FOR /F "TOKENS=*" %%A IN ("%g#%") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "!z#!" equ "%%A" (
  143. if "%%b" equ "3" (
  144. %z%
  145. set /a x=0,y=0,!str!
  146. set /a %p#k:@=ro%
  147. for /f "tokens=*" %%a in ("%zz%") do (
  148. endlocal
  149. set eek=%%~a
  150. )
  151. set "eek=!eek: =%v%[2C!"
  152. )
  153. set /a x1=x,y1=y*2+11
  154. echo;%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!
  155. ) else (
  156. set/a y=by,k=bk
  157. set str=!bs!
  158. )
  159. )
  160. )
  161. )
  162. goto :c
  163. :j
  164. set /a x1=x,y1=y*2+11,x-=1,$=0
  165. echo;%v%[1;23H!eev!%v%[!x1!;!y1!H!eek!
  166. set /a !str!
  167. for /f "tokens=*" %%a in ("%p#%") do (set /a %%a)
  168. set/a m=0,n=1
  169. for %%a in (!rs!) do (
  170. set /a n+=1
  171. FOR /F "TOKENS=*" %%A IN ("!gLineText:@=%%a!") DO FOR /F "TOKENS=*" %%A IN ("%%A") DO if "%%A" equ "1111111111" (
  172. set "rs= %%a!rs: %%a = !"
  173. set/a m+=1
  174. set /a "!pLineTo_0:@=%%a!"
  175. set  tx=!tx!!v![!n!;3H■■■■■■■■■■
  176. )
  177. )
  178. if !m! neq 0 (
  179. set n=0
  180. for %%a in (!rs!) do (
  181. set e!n!=%%a
  182. set /a n+=1,$=n %% 8
  183. mk /g >nul
  184. if !$! lss 3 (
  185. echo;!v![30m!tx!
  186. ) else (
  187. echo;!v![3!$!m!tx!
  188. )
  189. )
  190. set tx=
  191. set/a "fen=fen+m,guan=fen/10+1,fens=fens+l!m!*guan"
  192. )
  193. set eev=%ech%
  194. for /l %%a in (1,1,2) do for /f "tokens=*" %%b in ("!eev!") do set eev=%%b
  195. if !x! leq 1 (
  196. call :记录保存
  197. endlocal
  198. goto :rt
  199. )
  200. goto :l
  201. :记录保存
  202. echo 游戏结束!
  203. mk /w /c 3000
  204. cls
  205. echo;
  206. echo;高分排名:
  207. echo;
  208. %z%
  209. for /l %%a in (1,1,5) do set name%%a=无名氏&set zf%%a=0
  210. set n=0
  211. for /f "tokens=1,2" %%a in (%~n0.ini) do (
  212. set /a n+=1
  213. set name!n!=%%a
  214. set zf!n!=%%b
  215. for %%c in (!n!) do echo; %%c !name%%c! !zf%%c!分
  216. )
  217. echo;
  218. echo;
  219. for /l %%a in (1,1,5) do (
  220.     if not defined find (
  221.           if !fens! gtr !zf%%a! (
  222. echo;真厉害!本次得分:!fens!分,超过了第%%a名记录保持者:
  223. echo;【!name%%a!】 !zf%%a! 分
  224. echo;请留下您的大名:
  225. set /p name%%a=
  226. set /a find=zf%%a,zf%%a=fens
  227.          )
  228.     ) else (
  229.          set/a find=zf%%a,zf%%a=!find!
  230.     )
  231. )
  232. (
  233. for /l %%a in (1,1,5) do (
  234. echo;!name%%a! !zf%%a!
  235. )
  236. )>%~n0.ini
  237. endlocal
  238. goto :eof
  239. :exit
  240. echo 谢谢使用,再见。。。
  241. mk /w /c 3000  >nul
  242. goto :eof
  243. :p
  244. set /a dt=tt/1000-odt
  245. set /a zhen=tin/dt
  246. title 【暂停】!zhen!#!down! 按F2切换玩法,其它键继续。。。
  247. mk /w /c 999999999 >tt.txt
  248. for /f "tokens=1-5" %%1 in (tt.txt) do set 暂停=%%1%%2%%3
  249. if !暂停! neq 10113 set 暂停=
  250. title 批处理俄罗斯方块
  251. goto :eof
  252. :制表 宽 高 变量名
  253. %z%
  254. set/a 宽2=%1-2,高2=%2-2
  255. set "%3=!%3!!v!(0l!v!H"
  256. for /l %%a in (1,1,!宽2!) do (
  257.    set %3=!%3!q
  258. )
  259. set %3=!%3!k
  260. for /l %%b in (1,1,!高2!) do (
  261.    set %3=!%3!%v%[1B%v%[%1Dx%v%[!宽2!Cx
  262. )
  263. set %3=!%3!%v%[1B%v%[%1Dm
  264. for /l %%a in (1,1,!宽2!) do (
  265.    set %3=!%3!q
  266. )
  267. set "r=!%3!j!v!(B"
  268. endlocal&set %3=%r%
  269. goto :eof
复制代码

TOP

本帖最后由 netbenton 于 2021-12-26 01:06 编辑

最新、快版本。去掉了注释,变量名减短。可读性差了。


[url=链接:https://pan.baidu.com/s/15gaJrNs-gbKVyjH3X3604w]  提取码:bath[/url]

请看Gif动图。


TOP

真的是太强了,  原来还有那么多花样

TOP

太强大了!!!!!

TOP

返回列表