While Stack.GetCount("x1") > 0
x1 = Stack.PopValue("x1")
y1 = Stack.PopValue("y1")
x2 = Stack.PopValue("x2")
y2 = Stack.PopValue("y2")
len = Math.SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
If len > 1000 Then
GraphicsWindow.PenColor = "Wheat"
ElseIf len > 500 then
GraphicsWindow.PenColor = "LightGray"
ElseIf len > 150 then
GraphicsWindow.PenColor = "Gray"
ElseIf len > 90 then
GraphicsWindow.PenColor = "DarkBlue"
ElseIf len > 30 then
GraphicsWindow.PenColor = "Brown"
elseif len > 1 then
GraphicsWindow.PenColor = "DarkGray"
Else
GraphicsWindow.PenColor = "Black"
EndIf
GraphicsWindow.PenWidth = Math.Max(1, len / 20)
GraphicsWindow.DrawLine(x1,y1,x2,y2)
If len > .5 Then
ang = Math.ArcTan( (y2-y1)/(x2-x1) )
If x2
len = -len
EndIf
x2 = x1 + Math.Cos(ang)*len/3.0
y2 = y1 + Math.Sin(ang)*len/3.0
PushAndSwap()