Microsoft Small Basic

Program Listing: JTH842
' Geometric Pattern 0.1
' Copyright (c) 2014 Nonki Takahashi.
'
' Lisence:
' The MIT Lisence (MIT)
' http://en.wikipedia.org/wiki/MIT_License
'
' History:
' 0.1 2014-05-01 Created. ()
'
GraphicsWindow.Title = "Geometric Pattern 0.1"
gw = 598
gh = 428
bg = "Black"
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.BackgroundColor = bg
size = 60
pattern = 1
For y = 0 To gh Step size
Stack.PushValue("stack", pattern)
For x = 0 To gw Step size
If pattern = 1 Then
DrawPattern1()
Else
DrawPattern2()
EndIf
pattern = 3 - pattern
EndFor
pattern = Stack.PopValue("stack")
pattern = 3 - pattern
EndFor
Sub DrawPattern1
' param x
' param y
' param size
GraphicsWindow.BrushColor = "#222222"
size3_4 = size * 3 / 4
size_8 = size / 8
GraphicsWindow.FillRectangle(x + size_8, y + size_8, size3_4, size3_4)
EndSub
Sub DrawPattern2
' param x
' param y
' param size
GraphicsWindow.BrushColor = "SaddleBrown"
GraphicsWindow.FillEllipse(x, y, size, size)
GraphicsWindow.BrushColor = bg
size_2 = size / 2
size_4 = size / 4
GraphicsWindow.FillEllipse(x + size_4, y + size_4, size_2, size_2)
EndSub