Showing posts with label Shape. Show all posts
Showing posts with label Shape. Show all posts

Wednesday, October 6, 2010

Pi by chance

clg

in=0
color red
circle 150,150,150
color black
For dots = 1 to 10000
x=rand*300+1
y=rand*300+1
circle x,y,2
if ((x-150)^2+(y-150)^2)^.5<=150 then in=in+1
print in*4/dots
next dots

Tuesday, October 5, 2010

What is the angle?

dim arrow(8)
arrow = {0,0,0,0,0,70,0,0}
r=int(rand*2*pi)+.1
clg
fastgraphics
for i = 0 to r step .005
stamp 150,150,2,i,arrow
refresh
next i
input "What is the angle?",r$
print r*180/pi

Monday, October 4, 2010

Estimate the area

clg
color yellow
rect 0,0,300,300
color red
rect 0,0,20,20
h=int(rand*5)+1: l=int(rand*5)+1
rect 40,40,40+20*l,40+20*h
input "The small square is 1 cm^2 what is the area of the rectangle?",q$
color yellow : rect 40,40,40+20*l,40+20*h
color red
a=0
for s = 0 to h+1 : for n = 0 to l+1
  rect 40+20*n,40+20*s,19,19
  a=a+1
  print a
next n : next s