本帖最后由 aa77dd@163.com 于 2016-9-24 01:08 编辑
第 36 行 变量 sumOfStream 的值越大, 运行效果就越接近 我贴的图, 即螺线在屏幕上铺得越满, 有 螺旋星系 的感觉, 但运行也就会越慢- @echo off & title %~n0 & setlocal enabledelayedexpansion
-
- set "hexWid=50" & set "hexHei=3c" & REM 80,60
-
- for /f "tokens=2 delims=[]" %%a in ('ver') do for /f "tokens=2 delims=. " %%a in ("%%a") do set /a "FullScreen=-((%%a-6)>>31)"
- if "%1"=="" (
- for %%a in ( FontSize:00080008
- FontFamily:00000030
- WindowSize:00%hexHei%00%hexWid%
- ScreenColors:0000000a
- CodePage:000001b5
- ScreenBufferSize:00%hexHei%00%hexWid%
- FullScreen:!FullScreen:-=!
- ) do for /f "tokens=1,2 delims=:" %%b in ("%%a") do (
- >nul reg add HKCU\Console\TheMatrix /v %%b /t reg_dword /d 0x%%c /f
- )
- start "TheMatrix" /max "%ComSpec%" /c %~s0 1 & exit
- ) else ( >nul reg delete HKCU\Console\TheMatrix /f )
-
- REM "Main Title/Trinity Infinity" – 3:54
- if exist "%~dp0matrix4.mp3" (
- cd /d "%ProgramFiles%\Windows Media Player\"
- start /min wmplayer.exe "%~dp0matrix4.mp3"
- ) else (
- start /min http://pisa.ucsd.edu/cse125/2001/cse190g1/matrix4.mp3
- )
-
- set "Path=%SystemRoot%\system32"
- for /f "delims==" %%a in ('set') do if /i "%%a" neq "Path" if /i "%%a" neq "hexHei" if /i "%%a" neq "hexWid" set "%%a="
-
- REM trigonometric function
- set "SIN=(t-t*t/1875*t/320000+t*t/1875*t/15625*t/16000*t/2560000-t*t/1875*t/15360*t/15625*t/15625*t/16000*t/44800000)"
- set "COS=(10000-t*t/20000+t*t/1875*t/15625*t/819200-t*t/1875*t/15360*t/15625*t/15625*t/10240000+t*t/1875*t/15360*t/15625*t/15625*t/16000*t/15625*t/229376000)"
- set /a "ZM=10000, p=31416, p2=62832, pn2=-62832, p#2=15708, p3#2=47124, p3#2_=p3#2-1, DEG=31416/180"
-
- set /a "wid=0x%hexWid%, hei=0x%hexHei%, iMax=wid*hei, XC = wid/2, YC = hei/2, sumOfStream=40"
-
- set /a buffwid = wid
- set /a linesWantBackAbove = hei - 1
- set /a "cntBS = 2 + (buffwid + 7) / 8 * linesWantBackAbove"
-
- set "TAB= "
- for /F %%a in ('"prompt $h&for %%b in (1) do rem"')do Set "BS=%%a"
- REM set "BS="
-
- set "BSs="
- for /L %%a in (1 1 !cntBS!) do set "BSs=!BSs!%BS%"
-
- set "aLineBS="
- for /L %%a in (1 1 !wid!) do set "aLineBS=!aLineBS!%BS%"
-
- set "scr="
- for /l %%i in (1 1 !iMax!) do set "scr= !scr!"
-
- for /l %%n in (1 1 !sumOfStream!) do set "TL%%n=0"
-
- set /a "DEG_unit=3, lineHeiMax = 360 / DEG_unit / 2"
-
- for /l %%* in () do (
- for /l %%n in (1 1 !sumOfStream!) do (
- if !TL%%n! leq 1 (
- rem TL 总寿命结束, 重生 Rg 生长点位置; Rc 擦除点位置
- set /a "H%%n=!random! %% (lineHeiMax-45)+45,}%%n=0,CL%%n=!random! %% (H%%n -40) + 41,TL%%n=CL%%n+H%%n,H%%n+=1, {%%n=!random! %% 360 * DEG, Rg%%n=}%%n,Rc%%n=}%%n"
- )
-
- REM 当 0 < H, grow=-1, 继续生长; 否则, grow=0, 停止生长
- REM 当 CL < 1, old=-1, 开始擦除; 否则, old=0, 不擦除
- REM 当 CL = 0, old0=-1, 擦除点位置=出生点位置; 否则, old0=0, 擦除点位置=擦除点位置, 不变
- set /a "TL%%n-=1,CL%%n-=1,H%%n-=1,old=(CL%%n-1)>>31,grow=-H%%n>>31, old0=-^!CL%%n,Rc%%n=(old0&}%%n)|(~old0&Rc%%n)"
-
- if !old! neq 0 (set "chrc= ") else set "chrc="
-
- if !grow! neq 0 ( set /a "chrg= !random! & 1" ) else set "chrg="
-
- for %%i in (g c) do if defined chr%%i (
- REM 画生长点 或 擦除点
-
- set /a "U%%i%%n={%%n + p2 + (R%%i%%n - }%%n) * DEG_unit*DEG, U%%i%%n %%= p2, U%%i%%n += U%%i%%n>>31&p2, t=U%%i%%n, s1=(t-p#2^t-p3#2)>>31, s3=p3#2_-t>>31, t=(-t&s1)+(t&~s1)+(p&s1)+(pn2&s3), SINt=%SIN%, t=%COS%, COSt=(-t&s1)+(t&~s1), x=(XC*ZM + R%%i%%n * COSt)/ZM, y=(YC*ZM + R%%i%%n * SINt)/ZM, inScr=(x-0^x-wid)&(y-0^y-hei)"
-
- if !inScr! lss 0 (
- set /a "ind=x+y*wid+1, lenL=ind-1, lenR=iMax-ind"
- for /f "tokens=1,2,3" %%a in ("!lenL! !ind! !lenR!") do (set scr=!scr:~0,%%a!!chr%%i!!scr:~%%b,%%c!)
- )
-
- REM 生长点 或 擦除点变化到下一个位置
- set /a "R%%i%%n+=1"
- )
- )
-
- <nul set /p "=!aLineBS!" & (2>nul echo;%TAB%!BSs!) & <nul set /p "=%BS%"
- <nul set /p "=%BS%!scr:~0,-1!"
- )
- exit
复制代码
|