April 30, 2024, 08:27:33 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Seasons greatings by Boris

Started by pistol350, September 05, 2007, 12:42:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pistol350

This one ROCKS!!!!!!!!!!!!!!
Trust me!
I am sure there are many of you who have never seen such animation in a console window  ;D


'xmas.iba,DEC-2002,By Boris
DECLARE "kernel32",SleepEx(dwMilliseconds:INT, bAlertable:INT),INT
def snw$[25],scene$[25],grnd$[26],grt$[6],s$:string
def gz,w,b:int:def wrd[4]:uint
for n=1 to 24:snw$[n]=space$(80):grnd$[n]=space$(80)
for nn=1 to 3:replace$ snw$[n],int(rnd(79)+1),1,".":next nn:next n
wrd=2783918575,4225693575,453492014,64876348:grt$[5]=gosub mkg
wrd=2904638497,541233280,612402532,4794692:grt$[4]=gosub mkg
wrd=3039788271,567210119,545752484,63564092:grt$[3]=gosub mkg
wrd=623395880,541218692,168049956,34122052:grt$[2]=gosub mkg
wrd=2783921647,601789447,67608878,199044924:grt$[1]=gosub mkg
grnd$[0]="1":openconsole:locate 25,1:color 15,0:print string$(80,"#"),
do:setsc:for n=1 to 24:locate n,1:print scene$[n],:next n
sleepex(45,0):until (inkey$<>"")|(val(grnd$[0])=25):closeconsole:end
setsc:
gz=val(grnd$[0]):snw$[0]=snw$[24]
for n=24 to 1 step -1:scene$[n]=snw$[n]
   if rnd(3)>1 then snw$[n]=mid$(snw$[n-1],2)+left$(snw$[n-1],1) else snw$[n]=snw$[n-1]
   if n<6 then grt$[n]=mid$(grt$[n],2)+left$(grt$[n],1)
next n
if gz<13
   replace$ grnd$[gz],rnd(78)+1,2,"##":if rnd(3)>2 then replace$ grnd$[gz+1],rnd(79)+1,1,"#"
   if instr(grnd$[gz],"############################")
      grnd$[0]=str$(gz+1):grnd$[gz]=string$(80,"#")
   endif
else
   locate 25,36:color 15,rnd(3)-1:print " <ANY KEY> ",
endif
for n=1 to gz+1
   scene$[25-n]=left$(grnd$[n],80):if (n>5)&(n<11) then scene$[27-n]=left$(grt$[n-5],80)
next n:color 15,0:return
mkg:
s$="":for w=1 to 4:for b=0 to 31:if ((2^b)&wrd[w-1]) then s$=s$+" " else s$=s$+"#"
next b:next w:return s$+"###################################"

Regards,

Peter B.