标题: 黑客帝国数码雨
[打印本页]
作者: WANKOILZ
时间: 2008-5-28 14:07
标题: 黑客帝国数码雨
前几天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 ]
作者: slore
时间: 2008-5-28 14:08
有那个感觉……
作者: pusofalse
时间: 2008-5-28 15:43
感觉不用CMD的多进程 很难实现真正意义上的数码雨~
作者: HAT
时间: 2008-5-28 15:58
It's cool!
作者: hansom
时间: 2008-5-28 17:43
占个位子.
作者: terrytong
时间: 2008-5-28 19:01
如果有字母就好了。
作者: WANKOILZ
时间: 2008-5-30 11:32
改进后已经能够显示所有字符!
作者: cad55
时间: 2008-5-30 11:42
本论坛上有比它更好的雨........
作者: radem
时间: 2008-5-30 11:47
不是很流畅
但已经很不错了
作者: jfsy
时间: 2008-5-30 20:07
不太懂,收下学习学习
作者: laver8030
时间: 2009-7-28 02:40
速度快了点 而且没黑客中那种晶莹剔透的感觉
作者: 523066680
时间: 2009-7-28 11:04
bathome也讨论了
netbeton那个我很喜欢
http://bbs.bathome.cn/viewthread.php?tid=1393