Sunday, December 2, 2012

Venny

#Venn diagrams and logical operators
Font "Arial",30,100
For s = 1 to 5
clg
Text 20,20 ,"A"
Text 260,20 ,"B"
gosub circles
For n = 1 to 2000
x=rand*300
y=rand*300
A=0
B=0
gosub checkA
gosub checkB
if s = 1 then gosub one
if s = 2 then gosub two
if s = 3 then gosub three
if s = 4 then gosub four
if s = 5 then gosub five
next n
next s
end
one:
Text 140,250 ,"A"
if A=1 then circle x,y,2
return
two:
Text 100,250 ," A"+chr(1352)+"B"
if A=1 and B=1 then circle x,y,2
return
three:
Text 100,250 ," A"+chr(1357)+"B"
if A=1 or B=1 then circle x,y,2
return
four:
Text 120,250 ,"A'"
if not A=1 then circle x,y,2
return
five:
Text 100,250 ,"(A"+chr(1357)+"B)'"
if not (A=1 or B=1) then circle x,y,2
return
checkA:
if (x-100)^2+(y-150)^2<10000 then A=1
Return
checkB:
if (x-200)^2+(y-150)^2<10000 then B=1
Return
circles:
For x = 1 to 300
y=(-(x-200)^2+10000)^.5+150
circle x,y,2
circle x,-y+300,2
circle x-100,y,2
circle x-100,-y+300,2
next x
return