中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-11-23 15:18
47,820 topics / 349,938 posts / today 0 new / 48,298 members
DOS批处理 & 脚本技术(批处理室) » [Recommendation][Challenge Idea] Use a script to simulate the digital rain from The Matrix
Printable Version  30,428 / 67
Floor31 redtek Posted 2006-11-09 21:45
金牌会员 Posts 1,147 Credits 2,902
Floors 26 and 27 are too amazing, going beyond DOS batch processing.
This would require more professional tools like 3DMAX or Maya to achieve more effects, but it loses the meaning of the "thinking challenge" that the forum moderator advocated for using DOS batch processing~:)
Floor32 ccwan Posted 2006-11-09 23:40
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Featured!
Floor33 zh159 Posted 2006-11-10 00:05
金牌会员 Posts 1,467 Credits 3,687
This is the digital rain in HTML

digital_rain.htm



"digital_rain.htm" is very resource-intensive. You can appropriately reduce "Cols=33;"

digital_rain.bat

Floor34 electronixtar Posted 2006-11-10 00:22
铂金会员 Posts 2,672 Credits 7,493
A bit fake, not like, heh heh
I remember in the movie: The positions of the numbers are fixed, and then the transformation of each number in its fixed position creates an illusion of falling.
Floor35 pengfei Posted 2006-11-11 06:28
银牌会员 Posts 485 Credits 1,218 From 湖南.娄底
Here are the translated texts:

First code block:
<TITLE>Digital Rain ☆Produced by DOS Union pengfei☆</TITLE>

<BODY text=#00ff00 vLink=#008000 aLink=#008000 link=#008000 bgColor=#000000
background="" onload=writetext();>
<DIV id=nothing style="WIDTH: 889px; HEIGHT: 259px"></DIV>
<DIV align=center>
<SCRIPT language=JavaScript>
<!--
if (document.all){
Cols=10;
Cl=48;//Spaces are included so the real length is 24!
Cs=120;
Ts=18;
Tc='#008800';
Tc1='#00ff00';
MnS=20;
MxS=20;
I=Cs;
Sp=new Array();S=new Array();Y=new Array();
C=new Array();M=new Array();B=new Array();
RC=new Array();E=new Array();Tcc=new Array(0,1,2,3,4,5,6,7,8,9);
document.write("<div id='Container' style='position:absolute;top:0;left:-"+Cs+"'>");
document.write("<div style='position:relative'>");
for(i=0; i < Cols; i++){
S=I+=Cs;
document.write("<div id='A' style='position:absolute;top:0;font-family:Arial;font-size:"
+Ts+"px;left:"+S+";width:"+Ts+"px;height:0px;color:"+Tc+";visibility:hidden'></div>");
}
document.write("</div></div>");

for(j=0; j < Cols; j++){
RC=1+Math.round(Math.random()*Cl);
Y=0;
Sp=Math.round(MnS+Math.random()*MxS);
for(i=0; i < RC; i++){
B='';
C=Math.round(Math.random()*1)+' ';
M=B+=C;
}
}
function Cycle(){
Container.style.top=window.document.body.scrollTop;
for (i=0; i < Cols; i++){
var r = Math.floor(Math.random()*Tcc.length);
E = '<font color='+Tc1+'>'+Tcc+'</font>';
Y+=Sp;

if (Y > window.document.body.clientHeight){
for(i2=0; i2 < Cols; i2++){
RC=1+Math.round(Math.random()*Cl);
for(i3=0; i3 < RC; i3++){
B='';
C=Math.round(Math.random()*1)+' ';
C=' '+' ';
M=B+=C;
Y=-Ts*M.length/1.5;
A.style.visibility='visible';
}
Sp=Math.round(MnS+Math.random()*MxS);
}
}
A.style.top=Y;
A.innerHTML=M+' '+E+' ';
}
setTimeout('Cycle()',45)
}
Cycle();
}
// -->
</SCRIPT>
</DIV></TD></TR></TABLE></SCRIPT><BGSOUND balance=0
src="http://www.chinahacker.com/mid/topic.mid" volume=0 loop=20></TR>
<P align=center><FONT size=7><B><I><FONT
color=#ff0000></FONT></I></B></FONT></P>
<P align=center><FONT size=7><B><I><FONT
color=#ff0000>www.cn-dos.net</FONT></I></B></FONT></P>

Second code block:
<center><body background="http://www.bnbsdo.cn/scan.gif"><br></center>
<BGSOUND balance=0 src="http://www.bnbsdo.cn/fbi.mp3 " volume=-1 loop="-1">
<BODY text=#ffffff vLink=#ffffff aLink=#ffffff link=#ff0000 bgColor=#000000>
<p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>
<center><font size=8 face="Arial Black"><font color=#CC0000>www.cn-dos.net</font></center>
<title>Digital Rain ☆Produced by DOS Union pengfei☆</title>

<SCRIPT language=JavaScript>
<!--
if (document.all){
Cols=10;
Cl=48;//Spaces are included so the real length is 24!
Cs=120;
Ts=18;
Tc='#ffff00';
Tc1='#0099ff';
MnS=20;
MxS=20;
I=Cs;
Sp=new Array();S=new Array();Y=new Array();
C=new Array();M=new Array();B=new Array();
RC=new Array();E=new Array();Tcc=new Array(0,1,2,3,4,5,6,7,8,9);
document.write("<div id='Container' style='position:absolute;top:0;left:-"+Cs+"'>");
document.write("<div style='position:relative'>");
for(i=0; i < Cols; i++){
S=I+=Cs;
document.write("<div id='A' style='position:absolute;top:0;font-family:Arial;font-size:"
+Ts+"px;left:"+S+";width:"+Ts+"px;height:0px;color:"+Tc+";visibility:hidden'></div>");
}
document.write("</div></div>");

for(j=0; j < Cols; j++){
RC=1+Math.round(Math.random()*Cl);
Y=0;
Sp=Math.round(MnS+Math.random()*MxS);
for(i=0; i < RC; i++){
B='';
C=Math.round(Math.random()*1)+' ';
M=B+=C;
}
}
function Cycle(){
Container.style.top=window.document.body.scrollTop;
for (i=0; i < Cols; i++){
var r = Math.floor(Math.random()*Tcc.length);
E = '<font color='+Tc1+'>'+Tcc+'</font>';
Y+=Sp;

if (Y > window.document.body.clientHeight){
for(i2=0; i2 < Cols; i2++){
RC=1+Math.round(Math.random()*Cl);
for(i3=0; i3 < RC; i3++){
B='';
C=Math.round(Math.random()*1)+' ';
C=' '+' ';
M=B+=C;
Y=-Ts*M.length/1.5;
A.style.visibility='visible';
}
Sp=Math.round(MnS+Math.random()*MxS);
}
}
A.style.top=Y;
A.innerHTML=M+' '+E+' ';
}
setTimeout('Cycle()',45)
}
Cycle();
}
// -->
</SCRIPT>
[ Last edited by pengfei on 2006-11-26 at 10:36 AM ]
Floor36 lxmxn Posted 2006-11-11 07:15
版主 Posts 4,938 Credits 11,386
Well, Brother pengfei's this webpage is the "authentic" digital rain, heh heh
Floor37 zouzhxi Posted 2006-11-11 07:22
中级用户 Posts 177 Credits 430 From 广东深圳
I post the source code of the character stream in *The Matrix* for you to see, this is it!@#$%^&*()


This code comes from This's My Life Guestbook
Here is the effect address:
http://www.sqbook.com/asp/home/sqbook/index.
asp?adminuser=cnbohu

Character Stream in *The Matrix*




Wasting resources
lol lol
Got confused? Hehe...

[ Last edited by zouzhxi on 2006-11-11 at 07:38 AM ]
Floor38 electronixtar Posted 2006-11-11 07:56
铂金会员 Posts 2,672 Credits 7,493
Hehe~ It has become a competition of HTML digital rain.

The real digital rain requires outputting screen by screen. The position of each letter is fixed. The number changes in its own position, and then another number appears below this letter, and then another number appears below that number... Instead of a string of letters falling down.
Floor39 zh159 Posted 2006-11-11 12:28
金牌会员 Posts 1,467 Credits 3,687
The code in building 35 is the same as that in building 33, except for the following different parameters

Cols=10;Number of columns
Cl=48;//Space's are included so real length is 24!Maximum length of column
Cs=120;Column width
Ts=18;Font size
MnS=20;Minimum falling speed
MxS=20;Maximum falling speed

RC=new Array();E=new Array();Tcc=new Array(0,1,2,3,4,5,6,7,8,9);First digit transformation
Floor40 ccwan Posted 2006-11-11 21:31
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
All of you have done a lot of research! Hehe. I'm still very admiring.
Floor41 hxuan999 Posted 2006-11-13 02:00
中级用户 Posts 161 Credits 337
Oh

Two days without coming, it became a challenge of HTML digital rain.

I'll first release my code too. Everyone still study how to implement it purely with BAT.

My code is completely modified according to the code provided by the , but it's too slow. After researching for many days, I still can't speed it up. Also, I changed one implemented with 0 and 1. Still, this effect is better.


Code 1:


  1. @echo off
  2. ::mode con cols=80
  3. setlocal ENABLEDELAYEDEXPANSION
  4. color 02

  5. goto BEGIN
  6. goto :eof

  7. ::function mt_rand "a" "b"
  8. :mt_rand
  9. ::(
  10. set a=%~1
  11. set b=%~2
  12. set /a _mt_rand=(!random!%%(%b%-%a%))+%a%
  13. exit /b 0
  14. ::)

  15. :BEGIN
  16. ::{--
  17. SET iWidth=80
  18. SET iDensity=6

  19. SET sText="#$&'()*+,-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~
  20. SET sText=!sText:"=!
  21. set /A iText=90-1

  22. for /l %%i in (1,1,%iWidth%) do (
  23. set aDown%%i=0
  24. )
  25. :loop
  26. for /l %%I in (1,1,%iWidth%) do (
  27. set /a aDown%%I-=1
  28. if !aDown%%I! LSS 0 (
  29. call :mt_rand "0" "%iDensity%"&&set aArrow%%I=!_mt_rand!
  30. call :mt_rand "10" "25"&&set aDown%%I=!_mt_rand!
  31. )
  32. if !aArrow%%I! EQU 1 (
  33. call :mt_rand "0" "%iText%"&&(FOR %%M IN ("!_mt_rand!") DO SET aa=!sText:~%%~M,1!)
  34. set /p=!aa!<nul
  35. ) else (
  36. set /p= <nul
  37. )
  38. )
  39. goto loop

  40. ::--}

  41. :exit
  42. exit /b 0
hxuan?表ー: 2006-11-12 12:59


Code 2:


  1. @echo off
  2. setlocal ENABLEDELAYEDEXPANSION
  3. color 02

  4. for /l %%i in (1,1,80) do (
  5. set Down%%i=0
  6. )

  7. :loop
  8. for /l %%j in (1,1,80) do (
  9. set /a Down%%j-=1
  10. if !down%%j! LSS 0 (
  11. set /a Arrow%%j=!random!%%4
  12. set /a Down%%j=!random!%%15+10
  13. )
  14. if "!Arrow%%j!" == "1" (
  15. set /a chr=!random!%%2
  16. set /p=!chr!<nul
  17. ) else (
  18. set /p= <nul
  19. )
  20. )
  21. goto loop

  22. goto :eof
hxuan?表ー: 2006-11-12 13:01
Floor42 ccwan Posted 2006-11-13 21:24
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
The feeling from the person upstairs is not like rain, because rain goes downward. ^_^
Floor43 kennyfan Posted 2006-11-13 22:05
中级用户 Posts 112 Credits 259
The CPU usage is 100%, which is really scary!
Floor44 lgx8280998 Posted 2006-11-15 02:07
初级用户 Posts 22 Credits 52
If using goto to make an infinite loop.
(Manually add numbers in the batch processing)
Then define the display time of each line.
It should be a very realistic rain.
Floor45 lgx8280998 Posted 2006-11-16 10:57
初级用户 Posts 22 Credits 52
I said above to make a dead loop with goto. The code is as follows:



Simple and clear, just use ping -n 1 localhost>nul to define the display time of each line. You can think about how heavy the rain is. But after testing, there is a small problem, that is, directly pressing the XX in the upper right corner to close may cause a restart. But pressing ctrl+c to terminate will not. It should be due to the high CPU usage.

[ Last edited by lgx8280998 on 2006-11-16 at 11:11 AM ]
Prev  1 2 3 4 5  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023