Monday, February 23, 2015

Pythagoras Game

graphsize 600,400
color black
rect 0,0,600,400
color white
x1=int(rand*600)
y1=int(rand*400)
circle x1,y1,3
x2=int(rand*600)
y2=int(rand*400)
circle x2,y2,3
# Vertical and Horizontal distance
h=x1-x2
v=y1-y2
# Pythagoras formula
dist=sqrt(v^2+h^2)
Print "The black rectangle is 600 by 400"
input "What is the distance between the points",a
font "arial" ,30,30

text 150,200,"Distance="+int(dist)

1 comment: