| @echo off&setlocal enabledelayedexpansion |
| if not exist choice.exe echo 找不到choice.exe!&pause&exit |
| set file=1 |
| :begin |
| if not exist level%file%.txt echo 找不到第%file%关!&pause&exit |
| title 第%file%关 |
| cls |
| echo 正在加载…… |
| for /f %%a in (level%file%.txt) do (set aline=%%a) |
| set zs=0 |
| set y=0 |
| set mbs=0 |
| :next |
| if "!aline:~%zs%!"=="" goto alinelast |
| set /a zs=%zs%+1 |
| goto next |
| :alinelast |
| for /f %%a in (level%file%.txt) do (set /a y=y+1 |
| set aline=%%a |
| for /l %%b in (1 1 %zs%) do (call :sets %%b !y!) |
| ) |
| set /a czs=%zs%*2+1 |
| if %czs% leq 14 set czs=14 |
| mode con:cols=%czs% lines=%y% |
| :loop |
| cls |
| set nmb= |
| for /l %%y in (1 1 %y%) do ( |
| for /l %%x in (1 1 %zs%) do (set /p=!x%%xy%%y!<nul |
| for /l %%a in (1 1 %mbs%) do (if !mbx%%a!==%%x (if !mbx%%a!==%%x (if !mby%%a!==%%y (set/p=<nul |
| set mb=☆ |
| if "!x%%xy%%y!"=="▓" set mb=★ |
| if !mb!==☆ set nmb=1 |
| set/p=!mb!<nul)))) |
| if %%x==%psx% (if %%y==%psy% (set psd=1 |
| set/p=<nul |
| set/p=♀<nul))) |
| if not %%y==%y% echo. |
| ) |
| if "%nmb%"=="" goto win |
| choice /c WSAD46ER /n>nul |
| set movex=0 |
| set movey=0 |
| set cnm=0 |
| if %errorlevel%==1 (set movey=-1) |
| if %errorlevel%==2 (set movey=1) |
| if %errorlevel%==3 (set movex=-1) |
| if %errorlevel%==4 (set movex=1) |
| if %errorlevel%==5 (call :cleanarchives |
| set /a file=%file%-1 |
| goto begin) |
| if %errorlevel%==6 (call :cleanarchives |
| set /a file=%file%+1 |
| goto begin) |
| if %errorlevel%==7 exit |
| if %errorlevel%==8 (call :cleanarchives |
| goto begin) |
| set /a npsx=%movex%+%psx% |
| set /a npsy=%movey%+%psy% |
| if "!x%npsx%y%npsy%!"=="" set cnm=1 |
| if "!x%npsx%y%npsy%!"=="█" set cnm=1 |
| if "!x%npsx%y%npsy%!"=="▓" (call :movewall) |
| if "%cnm%"=="1" goto loop |
| set psx=%npsx% |
| set psy=%npsy% |
| goto :loop |
| ::========================== |
| goto :eof |
| :sets |
| set/a sx=%1-1 |
| set x%1y%2=!aline:~%sx%,1! |
| if "!aline:~%sx%,1!"=="♀" (set x%1y%2= |
| set psx=%1 |
| set psy=%2) |
| if "!aline:~%sx%,1!"=="☆" (set x%1y%2= |
| set /a mbs=!mbs!+1 |
| set mbx!mbs!=%1 |
| set mby!mbs!=%2) |
| goto :eof |
| :movewall |
| set /a wpsx=%movex%*2+%psx% |
| set /a wpsy=%movey%*2+%psy% |
| if not "!x%wpsx%y%wpsy%!"=="" (set cnm=1&goto :eof) |
| set x!wpsx!y!wpsy!=▓ |
| set x%npsx%y%npsy%= |
| goto :eof |
| :win |
| cls |
| echo 你赢了! |
| pause |
| call :cleanarchives |
| set /a file=%file%+1 |
| goto begin |
| goto :eof |
| :cleanarchives |
| for /l %%y in (1 1 %y%) do (for /l %%x in (1 1 %zs%) do (set x%%xy%%y=)) |
| goto :eofCOPY |