Author Topic: Animated Lotto  (Read 104 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 312
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Animated Lotto
« on: April 03, 2026 »
I wanted to do this years ago.
Couldn't even imagine how to code it.
Tried with various coding methods I'd learnt.
Finally got it.

It does a few things using the D-pad.
Down does the basic operation.
Left shows the last 20 randoms.

Code: [Select]
num=40

dim xs(num)
dim ys(num)
dim xe(num)
dim ye(num)

row=0
col=1
for a=1 to num
row=row+1
if row>8 then
col=col+1
row=1
endif
xs(a)=row*30+185
ys(a)=col*30+60
xe(a)=row*30+185
ye(a)=col*30+60
next a

amount=6
dim lot(amount)

b=20
a=6
dim lit(b,a)

dim shade(20)
for a=1 to 20
if frac(a/2)=0 shade(a)=50
if frac(a/2)=.5 shade(a)=100
next a

keys=16
dim go(keys)
dim g(keys)

shape=3
off=1
t=0
count=200
stop=1

open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")

for a=1 to keys
if and(c,2^(a-1))<>0 go(a)=1
if go(a)=1 g(a)=g(a)+1
if g(a)>2 g(a)=2
if g(a)=2 go(a)=0
if and(c,2^(a-1))=0 g(a)=0
next a

if go(6)=1 stop=stop+1
if stop>2 stop=1
if stop=1 sp=2
if stop=2 sp=0

if go(8)=1 off=off+1
if off>3 off=1

if go(5)=1 shape=shape+1
if shape>3 shape=1

if go(7)=1 then
for b=1 to amount
0 lot(b)=int(ran(40))+1
for a=1 to b
if a<>b if lot(b)=lot(a) goto 0
next a
next b
endif

if go(7)=1 t=t+1
if t>20 t=1
for b=1 to 20
for a=1 to 6
if t=b lit(b,a)=lot(a)
next a
next b

if go(6)=1 t=0
for b=1 to 20
for a=1 to 6
if go(6)=1 lit(b,a)=0
next a
next b

for a=1 to 20
setrgb 1,shade(a),shade(a),shade(a)
if off=3 fill rectangle 205,a*11+271 to 445,a*11+282
next a

for b=1 to 20
for a=1 to 6
if t=b setrgb 1,0,256,0
if t<>b setrgb 1,256,256,256
if off=2 or off=3 text a*42+167,b*11+280,str$(lit(b,a),"##")
next a
next b

row=0
if go(7)=1 if count=200 then
count=0
for b=1 to num
for a=1 to amount
if lot(a)=b then
row=row+1
xe(b)=row*42+175
ye(b)=260
endif
next a
next b
endif

count=count+1
if count>200 count=200

row=0
col=1
if count=200 then
for a=1 to num
row=row+1
if row>8 then
col=col+1
row=1
endif
xe(a)=row*30+185
ye(a)=col*30+60
next a
endif

for a=1 to num
if xs(a)>xe(a) xs(a)=xs(a)-sp
if xs(a)<xe(a) xs(a)=xs(a)+sp
if ys(a)>ye(a) ys(a)=ys(a)-sp
if ys(a)<ye(a) ys(a)=ys(a)+sp
next a

setrgb 1,256,256,256
for a=1 to num
text xs(a)-10,ys(a)+3,str$(a,"##")
if a<10 text xs(a)-10,ys(a)+3,"0"
if shape=2 rectangle xs(a)-15,ys(a)-15 to xs(a)+15,ys(a)+15
if shape=1 circle xs(a),ys(a),15
next a

for b=1 to num
for a=1 to amount
if lot(a)=b then
if count<200 setrgb 1,0,256,0
if stop=1 setrgb 1,256,256,256
text xs(b)-10,ys(b)+3,str$(b,"##")
if b<10 text xs(b)-10,ys(b)+3,"0"
endif
next a
next b

setrgb 1,256,256,256
x=0
y=1
for a=1 to num
x=x+1
if x>8 then
y=y+1
x=1
endif
if shape=3 rectangle x*30-15+185,y*30-15+60 to x*30+15+185,y*30+15+60
next a

until (1=0)
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.