[IAEP] [etoys-dev] TED - Alan Kay - Example(8:44)

forster at ozonline.com.au forster at ozonline.com.au
Fri Feb 19 23:22:27 EST 2010


I started trying to do something similar with Game Maker, a closed source but free visual language.

The proof of Pythagoras was too hard for me so I settled for a demonstration
see http://rupert.id.au/schoolgamemaker/samples3/

It wouldnt be too hard to port to Turtle Art or Etoys

Here's the code if it is of any use

for (i=x1;i<=x2;i+=25)                          /* baseline   */
{
    draw_line(i,y1,i,y1+x2-x1)        /*base verticals */
    draw_line(x1,i+y1-x1,x2,i+y1-x1)  /*base horizontals */
    
}
for (i=y1;i>=y2;i-=25)                           /*vertical */
{
    draw_line(x2-i+y1,y1,x2-i+y1,y2)   /*verticals*/    
    draw_line(x2,i,x2+y1-y2,i)                   /*horizontals*/
    
}
hyp=sqrt(sqr(y1-y2)+sqr(x2-x1))
alpha=arctan2((y1-y2),(x2-x1))
room_caption="Pythagoras' Theorem  horiz.="+string(sqr(x1-x2)/625)+
    "squares   vert.="+string(sqr(y1-y2)/625)+"squares   hyp=" +string((sqr(x1-x2)+sqr(y1-y2))/625)+"squares"
for(i=0;i<=hyp/25;i+=1)
{
    draw_line(x1-i*25*sin(alpha),y1-i*25*cos(alpha),        /*parallel*/
        x2-i*25*sin(alpha),y2-i*25*cos(alpha))
        
    draw_line(x1+i*25*cos(alpha),y1-i*25*sin(alpha),   /*perp*/
        x1-hyp*sin(alpha)+i*25*cos(alpha),y1-hyp*cos(alpha)-i*25*sin(alpha))

}

Tony


More information about the IAEP mailing list