### Post by Lloyd Muskrat on Jun 8, 2020 9:04:10 GMT -5

Just for fun, and for testing graphics, the pandemic simulator, greatly simplified, for LB5.

`nomainwin`

[createVariables]

dim dx(99),dy(99),f(99),condition(99),countdown(99)

[createWindow]

WindowWidth=800

WindowHeight=600

UpperLeftX=1

UpperLeftY=1

statictext #1.t1, "Sick: 1", 560, 50, 100, 30

graphicbox #1.gb, 50, 50, 500, 400

open "Graphics Test" for window as #1

#1 "trapclose [quit]"

[createSprites]

#1.gb "fill black;getbmp gb 1 1 500 400"

#1.gb "background gb"

#1.gb "down;place 1 1;color white;backcolor white;boxfilled 10 10;place 5 5;"

#1.gb "backcolor black;color black;circlefilled 5;place 5 15;color green;backcolor green;circlefilled 5"

#1.gb "getbmp simWell 1 1 10 20"

#1.gb "down;place 1 1;color white;backcolor black;boxfilled 10 10;place 5 5;"

#1.gb "backcolor black;color black;circlefilled 5;place 5 15;color blue;backcolor blue;circlefilled 5"

#1.gb "getbmp simHeal 1 1 10 20"

#1.gb "down;place 1 1;color white;backcolor black;boxfilled 10 10;place 5 5;"

#1.gb "backcolor black;color black;circlefilled 5;place 5 15;color red;backcolor red;circlefilled 5"

#1.gb "getbmp simSick 1 1 10 20"

simCount=70 'maximum 99

for a = 10 to simCount

x=int(300*rnd(1))

y=int(250*rnd(1))

#1.gb "addsprite sim";a;" simWell simWell simSick simSick simHeal simHeal"

#1.gb "spritexy sim";a;" ";x;" ";y

dx(a)=int(4*rnd(1))+1

if rnd(1)<.5 then dx(a)=0-dx(a)

dy(a)=int(4*rnd(1))+1

if rnd(1)<.5 then dy(a)=0-dy(a)

#1.gb "spritemovexy sim";a;" ";dx(a);" ";dy(a)

next a

'Create one "seed"

condition(10)=1

#1.gb "cyclesprite sim10 1"

countdown(10)=300

sickCount=1

timer 75, [animate]

wait

[animate]

scan

#1.gb "drawsprites"

for a = 10 to simCount

if condition(a)=1 then

countdown(a)=countdown(a)-1

if countdown(a)<=0 then

condition(a)=2

sickCount=sickCount-1

#1.t1 "Sick: ";sickCount

if sickCount=0 then [quit]

#1.gb "cyclesprite sim";a;" 0"

#1.gb "spriteimage sim";a;" simHeal"

end if

end if

#1.gb "spritexy? sim";a;" x y"

if x>450 then dx(a)=0-dx(a):f(a)=1

if y>350 then dy(a)=0-dy(a):f(a)=1

if x<1 then dx(a)=0-dx(a):f(a)=1

if y<1 then dy(a)=0-dy(a):f(a)=1

if f(a)=1 then

#1.gb "spritemovexy sim";a;" ";dx(a);" ";dy(a)

f(a)=0

end if

if condition(a)=0 then

#1.gb "spritecollides sim";a;" col$"

if col$<>"" then

chk=val(right$(col$,2))

if condition(chk)=1 then

dx(a)=int(4*rnd(1))+1

if rnd(1)<.5 then dx(a)=0-dx(a)

dy(a)=int(4*rnd(1))+1

if rnd(1)<.5 then dy(a)=0-dy(a)

#1.gb "spritemovexy sim";a;" ";dx(a);" ";dy(a)

condition(a)=1

sickCount=sickCount+1

#1.t1 "Sick: ";sickCount

countdown(a)=100

#1.gb "cyclesprite sim";a;" 1"

end if

end if

end if

next a

wait

[quit]

timer 0

notice "Simulation complete"

close #1

end