- %1 @goto :initCON
- @echo off & setlocal enabledelayedexpansion
- call :clearVars
- set /a "w=100,h=68, h1=h+0,t=w*h,xc=w/2+1,yc=h/2"
-
- set "TAB= " & for /F %%a in ('"prompt $h&for %%b in (1) do rem"')do Set "BS=%%a"
- set /a "buffwid = w, linesWantBackAbove = h + 1 - 1, cntBS = 2 + (buffwid + 7) / 8 * linesWantBackAbove"
- set "BSs=" & for /L %%a in (1 1 !cntBS!) do set "BSs=!BSs!%BS%"
- set "aLineBS=" & for /L %%a in (1 1 !w!) do set "aLineBS=!aLineBS!%BS%"
-
- mode %w%,%h1%
-
- for /l %%i in (1 1 !t!) do set "s=!s! "
- set "xv=-1" & set "yv=0 "
-
- set "pttn=.@.@.@.@.@.@.@."
- REM 画出初始曲线段
- set /a "x=xinit=28, y=yinit=-10, length=1, len2=(length-1) * 2"
- set /a "i=x-xc + (y-yc) * w + 1, L=i-1"
- for /f "tokens=1,2" %%a in ("!L! !i!") do (set s=!s:~0,%%a!!pttn:~0,1!!s:~%%b!)
- for /L %%L in (0 2 !len2!) do (
- set /a "x += !xv:~%%L,2!, y += !yv:~%%L,2!"
- set /a "i=x-xc + (y-yc) * w + 1, L=i-1"
- for /f "tokens=1,2" %%a in ("!L! !i!") do (set s=!s:~0,%%a!!pttn:~0,1!!s:~%%b!)
- )
- set "pttn=!pttn:~1!"
- call :f !xinit! !yinit! !length! s xv yv
- title complete & >nul pause &exit
- :f xtail ytail length s xv yv
- REM setlocal
-
- if %3 lss 4096 (
-
- set "vxr=" & set "vyr="
-
- set /a "x=%1, y=%2, len2=(%3 - 1) * 2, nextLength=%3 * 2"
- for /L %%L in (0 2 !len2!) do (
- set /a "xn = - !yv:~%%L,2!, yn = !xv:~%%L,2!"
-
- set /a "x += -xn, y += -yn" & rem xn,yn 得到顺时针90旋转 取反的值
- set /a "i=x-xc + (y-yc) * w + 1, L=i-1, inScr=(x-(-w/2+1)^x-(w/2+1))&(y-(-h/2+1)^y-(h/2+1))"
- if !inScr! lss 0 (
- for /f "tokens=1,2" %%a in ("!L! !i!") do (set s=!s:~0,%%a!!pttn:~0,1!!s:~%%b!)
-
- <nul set /p "=!aLineBS!" & (2>nul echo;%TAB%!BSs!) & <nul set /p "=%BS%"
- <nul set /p "=%BS%!s:~0,-1!"
- )
-
- set "xn= !xn!" & set "yn= !yn!"
- set "vxr=!xn:~-2!!vxr!" & set "vyr=!yn:~-2!!vyr!"
- )
- set "pttn=!pttn:~1!"
-
- set "xv=!vxr!!xv!" & set "yv=!vyr!!yv!"
-
- call :f !x! !y! !nextLength! %4 %5 %6
- )
-
- exit /b
-
- :initCON
- @echo off
- for %%a in ( FontSize:00080008 FontFamily:00000030 WindowSize:00C800C8
- ScreenColors:0000000f CodePage:000001b5 ScreenBufferSize:00C800C8
- ) do for /f "tokens=1,2 delims=:" %%b in ("%%a") do (
- >nul reg add HKCU\Console\Dragon_curve /v %%b /t reg_dword /d 0x%%c /f
- )
- start "Dragon_curve" /max "%ComSpec%" /c "%~0" REM & (call :delReg) & exit
- REM end of :initCON
- exit /b
- :clearVars
- set "Path=%SystemRoot%\system32"
- for /f "delims==" %%a in ('set') do (
- if /i "%%a" neq "Path" set "%%a="
- )
- exit /b
- REM end of :clearVars
- :delReg
- setlocal enabledelayedexpansion
- set "s=!time:~-4,1!"
- :delReg.loop
- set /a "elapse = (1!time:~-4,1! - s) %% 10"
- if %elapse% lss 2 goto :delReg.loop
- >nul reg delete HKCU\Console\Dragon_curve /f
- endlocal
- exit /b
- REM end of :delReg
复制代码
|