『楼 主』:
黑客帝国数码雨
前几天zw兄开发了不少数码雨,我也来个模拟黑客帝国的数码雨:
::code by WANKOILZ 2008/5/28
@echo off&setlocal enabledelayedexpansion&color 02&mode con lines=30&title 黑客帝国数码雨
setlocal&set flag=0
:loop
if %flag% lss 30 (set/a flag+=1) else (call :chang)
for /l %%i in (1,1,26) do (
if defined a%%i (set/a a%%i=!random!%%2&set tmp=!a%%i!
) else (if !random! lss 1000 (set/a a%%i=!random!%%2&set tmp=!a%%i!
) else (set tmp= ))
call set line%flag%=%%line!flag!%% !tmp!
)
cls&for /l %%i in (%flag%,-1,1) do echo.!line%%i!
for /l %%i in (1,1,100) do ver>nul
::ping /n 1 127.1>nul
if !random! lss 500 (endlocal&setlocal&set flag=0)
goto :loop
:chang
for /l %%i in (1,1,29) do (
set/a tmp=%%i+1
call set line%%i=%%line!tmp!%%
)
set line%flag%= 这个可以显示部分字符:
::code by WANKOILZ 2008/5/28
@echo off&setlocal enabledelayedexpansion&color 02&mode con lines=30&title 黑客帝国数码雨
setlocal&set flag=0&set code=1234567890abcdefghijklmnopqrstuvwxyz#*$~\/:
:loop
if %flag% lss 30 (set/a flag+=1) else (call :chang)
for /l %%i in (1,1,26) do (
if defined a%%i (call :set %%i&set tmp=!a%%i!
) else (if !random! lss 1000 (call :set %%i&set tmp=!a%%i!
) else (set tmp= ))
call set line%flag%=%%line!flag!%% !tmp!
)
cls&for /l %%i in (%flag%,-1,1) do echo.!line%%i!
ping /n 1 127.1>nul
if !random! lss 500 (endlocal&setlocal&set flag=0&set code=1234567890abcdefghijklmnopqrstuvwxyz#*$~\/:)
goto :loop
:chang
for /l %%i in (1,1,29) do (
set/a tmp=%%i+1
call set line%%i=%%line!tmp!%%
)
set line%flag%=
goto :eof
:set
set/a rnd=%random%%%43
set a%1=!code:~%rnd%,1! 5.30日改进,可以显示所有字符,因为用了太多的call导致速度有所降低:
:
::code by WANKOILZ 2008/5/28
@echo off&setlocal enabledelayedexpansion&color 02&mode con lines=30&title 黑客帝国数码雨
setlocal&set flag=0&set code=1234567890abcdefghijklmnopqrstuvwxyz#*$~\/:^&%%^^^<^>+=
:loop
if %flag% lss 30 (set/a flag+=1) else (call :chang)
for /l %%i in (1,1,26) do (
if defined a%%i (call :set1 %%i&set tmp=!a%%i!
) else (if !random! lss 1000 (call :set1 %%i&set tmp=!a%%i!
) else (set tmp= ))
call :set2
)
cls&for /l %%i in (%flag%,-1,1) do echo.!line%%i!
for /l %%i in (1,1,100) do ver>nul
::ping /n 1 127.1>nul
if !random! lss 500 (endlocal&setlocal&set flag=0&set code=1234567890abcdefghijklmnopqrstuvwxyz#*$~\/:^&%%^^^<^>+=)
goto :loop
:chang
for /l %%i in (1,1,29) do (
set/a tmp=%%i+1
call :set3 %%i
)
set line%flag%=
goto :eof
:set1
set/a rnd=%random%%%50
set a%1=!code:~%rnd%,1!
goto :eof
:set2
set line%flag%=!line%flag%! !tmp!
goto :eof
:set3
set line%1=!line%tmp%! [ Last edited by WANKOILZ on 2008-6-3 at 02:10 PM ]
此帖被 +4 点积分 点击查看详情 评分人:【 slore 】 | 分数: +4 | 时间:2008-5-28 14:08 |
|
|