标题: [特效代码] BAT脚本实现分形图:龙形曲线 [打印本页]
作者: a20150604 时间: 2017-4-14 15:29 标题: BAT脚本实现分形图:龙形曲线
- %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
复制代码
作者: 老刘1号 时间: 2017-4-14 21:47
本帖最后由 老刘1号 于 2017-4-14 21:49 编辑
每次看到这种帖子我都忍不住要安利下aa77dd兄的帖子http://www.bathome.net/thread-41913-1-1.html
作者: codegay 时间: 2017-4-14 21:58
回复 2# 老刘1号
→__→也许是同一个人呢
作者: 老刘1号 时间: 2017-4-14 22:46
本帖最后由 老刘1号 于 2017-4-14 22:48 编辑
回复 3# codegay
还别说,有可能……
在批家搜索框里输入FontSize: FontFamily: WindowSize:
或者ScreenColors: CodePage: ScreenBufferSize:
总能搜到一些让人惊奇的东东
话说这样的奇诡用法难道没有什么帖子讲解么。。。
作者: codegay 时间: 2017-4-14 23:22
回复 4# 老刘1号
猜啊
作者: 老刘1号 时间: 2017-4-14 23:53
回复 5# codegay
兄所言甚善
作者: 牛虻 时间: 2017-4-20 14:13
回复 1# a20150604
能不能画出个中国地图?
世界地图更厉害了
作者: 老刘1号 时间: 2017-4-22 19:26
回复 7# 牛虻
这是算法……不是固定复制上去的……
作者: bbaa 时间: 2017-4-22 22:06
回复 4# 老刘1号
煋,这是修改CMD属性的注册表HKEY_CURRENT_USER\Console
比如说你可以通过修改注册表给cmd的字体大小 颜色之类的进行魔改
作者: 老刘1号 时间: 2017-4-22 22:57
回复 9# bbaa
太好玩 感觉停不下来了……
作者: shenyu 时间: 2018-10-6 18:07
- @echo off
- echo "膜拜大佬"
- pause
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |