Post by tsh73 on Nov 21, 2020 15:12:52 GMT -5
As they say, it is "a long and sad tail".
Takes 5 minutes to run.
References are in code.
(source link has Russian and English versions. Facts are different but outcome is the same)
Takes 5 minutes to run.
References are in code.
(source link has Russian and English versions. Facts are different but outcome is the same)
'0A programmers
'for LB by tsh73, Nov 2020
'verse
'by Michail Samuilovich Kachan
'from
'https://proza.ru/2018/09/06/215
'Of cource it's all Agatha Christie
'https://en.wikipedia.org/wiki/And_Then_There_Were_None
nomainwin
WindowWidth = 600
WindowHeight = 400
UpperLeftX = (DisplayWidth-WindowWidth)/2
UpperLeftY = (DisplayHeight-WindowHeight)/2
global fnt$, h
fnt$="font courier_new bold 0 "
h=2
open "0A programmers" for graphics_nsb_nf as #gr
#gr "down; home; posxy cx cy"
#gr "trapclose [quit]"
'goto [skip]
read dropCap$
read msg$
s = 60
#gr fnt$;s
x=s:y=cy
#gr "place ";x;" ";y
'#gr "\";msg$
call shrinkLB x,y,dropCap$,50,160,s
call typeWriter x,y,msg$,100
s = 24
pauseMil = 4000
pauseMsg$ = "-=* just in case, you can close this program now *=-"
gosub [breakablePause]
ind$=space$(3)
mil=60
for kk= 10 to 0 step -1
'restore [line0]
'for kk= 0 to 0 step -1
'4 lines per page
#gr "cls"
x = 30
y = 120
'1) first start with dropCap
read dropCap$
read msg$
'except last verse
if dropCap$<>"" then
call shrinkLB x,y,dropCap$,50,100,s
end if
#gr fnt$;s
call typeWriter x,y,msg$, mil
gosub [CRLF]
'2) second starts with indent
read msg$
msg$ = ind$; msg$
call typeWriter x,y,msg$, mil
gosub [CRLF]
'3)
read msg$
call typeWriter x,y,msg$, mil
gosub [CRLF]
'4) last ends with dropCap
'and starts with indent
read msg$
read dropCap$
msg$ = ind$; msg$
call typeWriter x,y,msg$, mil
#gr "stringwidth? msg$ w"
x=x+w
call growLU x,y,dropCap$,50,s,100
pauseMil = 4000
pauseMsg$ = "-=* just in case, you can close this program now *=-"
gosub [breakablePause]
next
'kind of ending
#gr fnt$;s
y0=2*cy
y=y0
first=1
while y>0
msg$ = ""
for i = 1 to 15'really, I just count then from screen
'dies here. I guess too complex expression...
'msg$ = msg$ +right$("0";decHex$(int((first+(1-first)*rnd(0))*255)),2)+" "
if first then
msg$ = msg$ +"FF "
else
h = int(rnd(0)*255)
h$=right$("0";decHex$(h),2)
msg$ = msg$ +h$+" "
end if
next
call typeWriter 16,y0,msg$, mil
'wait
#gr "getbmp bmpName 0 ";s;" ";2*cx;" ";2*cy-s
#gr "cls"
#gr "drawbmp bmpName 0 0"
first=0
y=y-s
timer 200, [nxt3] 'breakable pause
wait
[nxt3]
timer 0
wend
'no, really, the end
#gr "cls"
s = 50
#gr fnt$;s
x=s:y=cy
#gr "place ";x;" ";y
msg$="That's all, folks"
#gr "\";msg$
pauseMsg$ = "-=* Really, the rhyme is over *=-"
gosub [breakablePause]
wait
[quit]
close #gr
end
[CRLF]
'changes x,y for one line down
#gr "place ";x;" ";y
#gr "\"
#gr "posxy x y"
return
[breakablePause]
'prints centered message
#gr fnt$;16
#gr "stringwidth? pauseMsg$ w"
#gr "place ";cx-w/2;" ";2*cy-2*s
#gr "\";pauseMsg$
'and just waits
timer pauseMil, [nxt2]
wait
[nxt2]
timer 0
return
'=============================================================
sub shrinkLB x,y,msg$, mil, size0, size1
'LB way - character prints from x,y - Left Bottom
h = 2
for i = size0 to size1 step sign(size1-size0)*h
call pause mil
#gr "place ";x;" ";y
#gr fnt$;i
#gr "\";msg$;" "
next
end sub
sub growLU x,y,msg$, mil, size0, size1
'character prints from x,y - Left Up
prev=size0
y0=y
h = 2
for i = size0 to size1 step sign(size1-size0)*h
call pause mil
#gr fnt$;i
'get printing point y0 so upper edge of character stays
#gr "place ";x;" ";y0
#gr "\"
#gr "posxy dummy y"
hh=y-y0
y0=y0+(hh-prev)
'print i, hh, x, y0, msg$
#gr "place ";x;" ";y0
#gr "\";msg$
prev = hh
next
end sub
function sign(x)
sign=(x>0)-(x<0)
end function
sub typeWriter x,y,msg$, mil
for i = 0 to len(msg$)
if mid$(msg$,i,1)=" " then i0=i0+1 else exit for
next
for i = i0 to len(msg$)
#gr "place ";x;" ";y
#gr "\";left$(msg$,i)
timer mil, [nxt]
wait
[nxt]
timer 0
if mid$(msg$,i,1)=" " then call pause mil*2 'extra pause
next
[quit]
timer 0
end sub
sub pause mil
t0=time$("ms")
while time$("ms")-t0<mil
scan
wend
exit sub
[quit]
end sub
'=============================================================
data "0A", "0A programmers"
data "0A", "0A young programmers"
data "began to work online,"
data "One didn't pay for Internet,"
data "and then there were ", "9."
data "9", "9 young programmers"
data "used copies that they made,"
data "But one was caught by FBI,"
data "and then there were ", "8."
data "8","8 young programmers"
data "discussed about heaven,"
data "One said 'It's Windows 95!',"
data "and then there were ","7."
data "7","7 young programmers"
data "found bugs they tried to fix,"
data "But one was fixed by the bug,"
data "and then there were ","6."
data "6","6 young programmers"
data "were testing the hard drive,"
data "One got the string 'Format complete',"
data "and then there were ","5."
data "5","5 young programmers"
data "were running the FrontDoor,"
data "The BBS of one was hacked,"
data "and then there were ","4."
data "4","4 young programmers"
data "worked using only C,"
data "One said some good about Pascal,"
data "and then there were ","3."
data "3","3 young programmers"
data "didn't know what to do,"
data "One tried to call the on-line help,"
data "and then there were ","2."
data "2","2 young programmers"
data "were testing what they've done,"
data "One got a virus in his brain"
data "and then there was ","1."
data "1","1 young programmer"
data "was mighty as a hero,"
data "But tried to speak with user,"
data "and then there were ","0."
[line0]
data "","Boss cried:'Oh, where is"
data "the program we must have?!'"
data "And fired one programmer,"
data "and then there were ","FF."