Dark Bit Factory & Gravity

PROGRAMMING => Other languages => Yabasic => Topic started by: bikemadness on October 29, 2021

Title: Multiple Multiples
Post by: bikemadness on October 29, 2021
Multiples of the number at the bottom of each column.

No, not the green one.

That and the red one are additional information.

L/R D-Pad to operate.

Code: [Select]
open window 640,512
a=0
repeat
c=peek("port1")

if and(c,32)>0 right=1
if right=1 R=R+1
if R>2 R=2
if R=2 right=0
if and(c,32)=0 R=0

if and(c,128)>0 left=1
if left=1 L=L+1
if L>2 L=2
if L=2 left=0
if and(c,128)=0 L=0

if right=1 then
a=a+12
z=0
clear window
endif

if left=1 then
a=a-12
z=0
clear window
endif

if a<0 a=0

for x=1+a to 12+a
z=z+1
row=0
y=0

for y=1 to 1200

if frac(x/y)=0 then
row=row+1
setrgb 1,256,256,256
text z*53.5-53.5,row*15,str$(y)
endif

next y

setrgb 1,0,256,0
text z*53.5-53.5,(row+1)*15,str$(row)
setrgb 1,256,0,0
if row<3 text z*53.5-53.5,(row+2)*15,"prime"
if frac(row/2)<>0 text z*53.5-53.5,(row+2)*15,"sq"

next x

until (1=0)