[MWForum]MIA, Ask an Expert Question

Dan Stone mwforum@lists.mathcats.com
Sun, 30 May 2004 17:52:31 -0400


> (This is not strictly a MW question but someone might want
> to answer it using MW)
> 
> from: orangetow@yahoo.com
> date: Sun, 30 May 2004 7:54:02 -0600
> 
> if an octagon's diagnals are 139.25 inches,how long is each 
> of its 8 sides

Just playing around with a turtle starting at the home position of 0
0... 
I would move fd 57.67 turtle steps for each side to return to my
starting position. 
This shape would take 139.25 turtle steps to get the turtle from one
corner to another on the opposite side.

My quick and dirty procedure - I just changed the side length until the
shape could 'hold' the diagonals
that were drawn as 2 rectangles.

to oct
;prep work
 make "diag 139.25    ;given
 make "side 57.67     ;change until diagonals fit the shape
 make "angle 360 / 8  ;given
 st pu setc "black
 setpos[0 0] ;home
 pd

;octagon drawn
 repeat 8[fd :side rt :angle]

;diagonals (2 rectangles)
;corner 1 - 2 - 5 - 6 - 1
 repeat 2[setc "black fd :side rt 90 setc "red fd :diag rt 90]
;go to corner 8
 setc "black
 lt :angle
 bk :side
 rt :angle
;corner 8 - 3 - 4 -7 - 8
 repeat 2[setc "red fd :diag rt 90 setc "black fd :side rt 90]
;return start position & heading
 lt :angle fd :side
 rt :angle
 show pos
;perfect solution - turtle at pos 0,0
End

Okay, have I made a mountain out of a molehill? <grin>
What would be a better way to have done this?

Thanks,

Dan