China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 10:07
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] Push Box Batch Processing Game View 12,789 Replies 63
Floor 16 Posted 2009-09-05 23:51 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
回 exist:
You mean to go from easy to difficult, so that players can unknowingly become push box masters, right?
It's not difficult to complete these, but I don't know if everyone will recognize this game. If it's meaningless after completion, I won't do it anymore.

In fact, it's simple to do, it's all physical work:
1. The order of difficulty, as long as the level data is changed in order;
2. To add levels, as long as the map is made, after being converted by the attached program, the level number is pasted in.
精简
=> 个人网志
Floor 17 Posted 2009-09-06 01:24 ·  中国 广东 广州 电信
银牌会员
★★★★
SuperCleaner
Credits 2,362
Posts 1,133
Joined 2008-02-02 21:36
18-year member
UID 110072
Gender Male
Status Offline
Haha, didn't expect this suggestion.
The original difficulty jump is quite good. I mean, when playing intellectual leisure games, one shouldn't be impatient.
Games are for relaxation. If you get stuck at a certain level, you can take a break and come back when you have time.

Anyway, the levels are recorded anyway.


There's nothing else. The only thing is the very hard-to-fix screen-flickering.
I think it's great that batch processing can write games suitable for batch processing.

There should be a part of people who like this quite a bit.
For the update, it's okay to do it when free. Inspiration can't be forced...
Floor 18 Posted 2009-09-06 02:08 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Just played around, it's pretty good heh. It's just that the flickering in the P processing... not perfect...
S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore
Floor 19 Posted 2009-09-06 03:24 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
Thanks to the previous opinion from slore, the screen flickering problem has been eliminated.

Welcome everyone to use and put forward valuable opinions.
精简
=> 个人网志
Floor 20 Posted 2009-09-06 03:50 ·  中国 广东 广州 电信
银牌会员
★★★★
SuperCleaner
Credits 2,362
Posts 1,133
Joined 2008-02-02 21:36
18-year member
UID 110072
Gender Male
Status Offline
I mentioned your post in the cn-dos group, but they said they didn't know and asked me to send the link...
It seems that the "promotion" strategy wasn't well done...
If the modest handsome guy doesn't promote, many people won't see it.
Floor 21 Posted 2009-09-06 09:12 ·  中国 四川 成都 电信
中级用户
★★
Credits 274
Posts 192
Joined 2009-01-07 21:09
17-year member
UID 136069
Gender Male
Status Offline
You are really amazing, I admire you.
Floor 22 Posted 2009-09-06 10:56 ·  中国 福建 三明 电信
高级用户
★★
论坛上抢劫的
Credits 551
Posts 246
Joined 2006-09-21 12:35
19-year member
UID 63270
Status Offline
Not compatible with Windows 7 x64 bit, and please release the first code, now the streamlined one is really hard to read!
Floor 23 Posted 2009-09-06 10:57 ·  中国 广东 广州 电信
银牌会员
★★★★
SuperCleaner
Credits 2,362
Posts 1,133
Joined 2008-02-02 21:36
18-year member
UID 110072
Gender Male
Status Offline
Senior above, I just saw you in the essence post... And then you appeared
http://www.cn-dos.net/forum/viewthread.php?tid=25517


If it's okay with you, netbenton, sort out a modular one and post it, and we'll take a look...
Well, if the viewers really want to understand the code, they can take their time to cut (read) it.

[ Last edited by 523066680 on 2009-9-6 at 11:00 ]
Floor 24 Posted 2009-09-06 12:02 ·  中国 福建 三明 电信
高级用户
★★
论坛上抢劫的
Credits 551
Posts 246
Joined 2006-09-21 12:35
19-year member
UID 63270
Status Offline
Originally posted by 523066680 at 2009-9-6 10:57:
Well, if the readers really want to understand the code, they can also cut it slowly

There's no time right now!
Floor 25 Posted 2009-09-06 12:07 ·  中国 广东 广州 电信
银牌会员
★★★★
SuperCleaner
Credits 2,362
Posts 1,133
Joined 2008-02-02 21:36
18-year member
UID 110072
Gender Male
Status Offline
This code is estimated to have many interesting parts. It won't be possible for the building owner to explain in a short while. Let the owner know which part it is and see if the building owner can talk about it. (By the way, advertising. I have some works with explanations, in the index of the signature.)
Floor 26 Posted 2009-09-08 12:23 ·  中国 湖南 常德 电信
初级用户
Credits 42
Posts 27
Joined 2009-02-24 16:42
17-year member
UID 139744
Gender Male
Status Offline
Floor 27 Posted 2009-09-09 11:46 ·  中国 广东 江门 电信
初级用户
★★
Credits 167
Posts 95
Joined 2007-05-06 09:19
19-year member
UID 87628
Gender Male
Status Offline
So powerful~~ I added a super strong picture at the back today~~ The result couldn't be displayed~~ So depressed~~ Which one set the number of lines to display~ I want to change it~
Floor 28 Posted 2009-09-09 12:53 ·  中国 广东 江门 电信
初级用户
★★
Credits 167
Posts 95
Joined 2007-05-06 09:19
19-year member
UID 87628
Gender Male
Status Offline
Who helps me add this picture in~~~ I have modified it~ but when adding it, it can't display all~~~

:囧g9g7a4 g5a5g3a4b2a a4gab3a6b4a9a ab2a3bab8ab9b2a abcd5ababcbabad2ab4c2aba

ab2a2d3cb2abcabad2b2a2b3cba3 ab4ca2cabacbcbad2ab2a2cabcb2a abcacb3cb2abcb2ad2b3ab2cbcb2a

a2b3a3cabad3a2d2ab2abcacb3a ga2ba2bab3ad2a3bdb3abcbcba3 a3bab2a9ab2ab2ab3a4

ab7a2b6ab2ab4a6 abcacacbab3cbcb2a9ab2a adcdb2cbab2cbcbcb7bcb3ca ad3a2b2a5ca9b2dadba

a4b3a6bdbd2ab3a2ba3ba2 g3ab2db2cbab2dab2adaca2bdadb2a g3a3d2bcbabdb3dab4acb3cba

g3a3c22bcbaba2b2a2dacbab2a4a ga3bdcdbab3a6b3a2ba2 gab2cd3ca5g4adacab2a
gab3a2dcbag6a2b5a2 ga6b3ag6abdaca3 g6a5g6ab4a g9g8afba3 g9g8a4
Floor 29 Posted 2009-09-09 12:57 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
Batch Processing Sokoban Source Code Explanation:

1. Use of Compact Format for Data Definition
First, put the variable definition set into a variable: (Note that the delimiter is unique, here using the ";" sign)
set a=a=i75;b=i79;str=abc
So the value of variable a is: a=i75;b=i79;str=abc
Use variable value replacement during preprocessing:
set %a:;=&set %
Equivalent to the following statements being executed:
set a=i75&set b=i79&set str=abc
Or:
set a=i75
set b=i79
set str=abc
If there are many variables to define, comprehensively considering from the perspective of occupied space and readability, this method has obvious advantages.


2. "Sokoban" Program Implementation Algorithm
1). Read the level data into an array: lev(n)
Change the value of n, which is to change the level, here n=%lev%
2). Restore the current level map data and store it in a two-dimensional array: r(n).(m)
(1) Collect the variable names r(n).(m) with the value "☆" into variable ke, and store the number of "☆" into variable ji, and convert them to "★" at the same time;
%ke% after expansion is the real-time value of all two-dimensional variables with the source value "☆"; as long as %ke% is equal to !ji! it means the level is passed
(2) Store the two-dimensional variable names as an array by row: r(n)
%r(n)% after expansion is the real-time value of all two-dimensional arrays in row n

3). Variable ebuf is used as a display buffer, all content to be displayed is stored in ebuf, and all is displayed at once with echo !ebuf!

Because after expansion of for variable %%a, the! -quoted variable will be expanded again, so:
for /l %%a in (1,1,!r!) do for %%b in ("!r%%a!") do set ebuf=!ebuf! %%~b!cr!
The above sequentially stores the expanded values of the variable name array r(n) from row 1 to!r! into the display buffer ebuf, and adds the newline character!cr!
4). First define the operations for up, down, left, and right:
"c1=n-;c2=m-;c3=n+;c4=m+"
In this way, through the following code:
set/a sm=m,sn=n,!c%in%!=1,bm=m,bn=n,!c%in%!=1
Respectively obtain the source points: sm.sn, step one: bm.bn, step two: m.n, the values of the three coordinates after pressing up/down/left/right

for /f "tokens=1,2" %%a in ("!r%bn%.%bm%! !r%bn%.%bm%!!r%n%.%m%!") do (
Take out the values of the three coordinates and spread them out as: (step one => %%a) (step one + step two =>%%b) For example: %%a=▓ %%b=▓∷

for %%c in ("!%%a!!%%b!") do (
%%a %%b after re-expansion, grouped into %%c, continuing the example:!▓! => empty,!▓∷! =>▓-∷
Then: ▓-∷ => %%c

for /f "tokens=1,2 delims=-" %%1 in (%%c) do (
Spread out as: %%1=▓, %%2=∷
Next is the if judgment, according to various situations, adjust the values of the three points and a "large" standing! source! point again

Note: There is a point, if the value of %%c is empty, such as when %%b=▓■, then this for will be an empty loop, that is, even the if statement inside will not be executed, making the following set/a m=sm,n=sn be executed


3. Compression and Restoration of Level Data
1). Compression: Since full-width characters are double-byte, converting to single characters can reduce by half. If ▓=a, zf=▓, then: set zf=!%af%! can be converted back
If there are not only one continuous ones, then a number is added after the letter to indicate the number. If it exceeds 9, start a new group, such as: a11, then split into a9a2

2). Restoration, reference: The advantage of starting with 囧,

for /f "tokens=2* delims=囧" %%a in (%~nx0) do (set lev!n!=%%a&set/a n+=1)
In this way, when reading, the reading of other non-data lines can be subtracted, and the speed is accelerated
Similarly, convert the characters back, and then use the 搂 character as the for /l count to repeat to convert all
if "!tn:%%2=!" neq "!tn!" (set k=%%2) else (set k=1)
for /l %%k in (1,1,!k!) do (
The above!k! is the number of characters


4. Get Rid of choice.exe and Screen Flashing
That is, use debug.exe instead, but this is usually available in all DOS systems, so. third-party...
debug <%~nx0>nul
Call itself as pipeline input, the first line is wrong, only two lines are really useful
e 100 cd 16 86 c4 b4 02 cd 10 b4 4C CD 21 Write code
g Execute
Here, key reading is performed, set the current cursor position to the first line, first column, and the key data is used as the return code to: %errorlevel%
Definition: "a=i83=10;i1=7;i72=1;i80=3;i75=2;i77=4;i73=8;i81=9;i57=5;i79=6"
Execution: set in=!i%errorlevel%!
Then get the key situation according to the definition, if not defined, it is empty

Usually, when writing a batch processing to return to the first line to display, only use cls, and then display again. Obviously, the speed is also very fast, but I still feel a bit flashing.
Directly reset the cursor to the first line, first column, without clearing the screen, and when displaying again, it is based on the original one, so the feeling of flashing is reduced
If you look at the assembly source code, it is very simple. Just remove >nul after debug <%~nx0>nul, and add a line u between the e line and the g line.


5. Player Record Saving and Reading
Here, the record is stored in the first line of the batch processing,

1). Reading
set/p yg=< %~nx0 >nul
Take the first line to variable yg
set yg=!yg:~13,52!
set lev=%yg:@=&rem %
Because the current level record and the passed level record are separated by @, so only the part before @ is given to lev, and the part after @ is commented out by rem
set yg= !yg:* =!
Only take the passed data, and keep the space before and after
In this way, the current level and the passed level data are all read into the variable
2). Saving

set a=a 10d`db "!lev!@!yg! "``w`q
(echo %a:`=&echo;%)|debug %~nx0 >nul
Expanded to:
(echo a 10d&echo;db "!lev!@!yg! "&echo;&echo;w&echo;q)|debug %~nx0 >nul
Actually, the following command line is handed to debug to execute:

a 10d
db "!lev!@!yg! "

w
q

Using the a command of debug to input assembly instructions, you can use db to define a string, and then directly use the W command to write to the opened file
And the batch processing program can modify itself during execution
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
523066680 +15 2009-09-10 06:28
sl543001 +2 2009-10-01 17:13
精简
=> 个人网志
Floor 30 Posted 2009-09-09 13:08 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
The first line of the map must have the maximum number of characters.

I adjusted it again, and indeed, it can't support this super large map. Also, it can't be displayed that wide. It's a bug in the program. I'll improve it when I have time.

Thank you for your test

[ Last edited by netbenton on 2009-9-9 at 11:49 ]
精简
=> 个人网志
Forum Jump: