GraphicsWindow.Title = "Turtle Tartan"
Init()
' horizontal pattern
Turtle.Angle = -135
GraphicsWindow.PenWidth = 2
For i = 0 To gw + gh Step 4
j = 1
x1 = i
y1 = 0
ymax = i
GraphicsWindow.PenColor = pattern[j]["color"]
y = pattern[j]["width"]
If ymax < y Then
y = ymax
EndIf
While y <= ymax
y2 = y
x2 = x1 - (y2 - y1)
DrawLine()
If y < ymax Then
x1 = x2
y1 = y2
j = j + 1
If Array.GetItemCount(pattern) < j Then
j = 1
EndIf
y = y + pattern[j]["width"]
If ymax < y Then
y = ymax
EndIf
GraphicsWindow.PenColor = pattern[j]["color"]
Else
y = ymax + 1
EndIf
EndWhile
EndFor
' vertical pattern
Turtle.Angle = 45
GraphicsWindow.PenWidth = 1
For i = 2 To gw + gh Step 4
j = 1
x1 = 0
y1 = i
xmax = i
GraphicsWindow.PenColor = pattern[j]["color"]
x = pattern[j]["width"]
If xmax < x Then
x = xmax
EndIf
While x <= xmax
x2 = x
y2 = y1 - (x2 - x1)
DrawLine()
If x < xmax Then
x1 = x2
y1 = y2
j = j + 1
If Array.GetItemCount(pattern) < j Then
j = 1
EndIf
x = x + pattern[j]["width"]
If xmax < x Then
x = xmax
EndIf
GraphicsWindow.PenColor = pattern[j]["color"]
Else
x = xmax + 1
EndIf
EndWhile
EndFor