Microsoft Small Basic
Program Listing:
Embed this in your website
<object id='sbapp' data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='640' height='480'> <param name='source' value='http://smallbasic.com/program/ClientBin/SBWeb.xap'/> <param name='onError' value='onSilverlightError' /> <param name='background' value='white' /> <param name='minRuntimeVersion' value='3.0.40624.0' /> <param name='autoUpgrade' value='true' /> <param name='initParams' value='programId=RQW402' /> </object>
x
=
10
y
=
320
GraphicsWindow
.
BackgroundColor
=
"Black"
GraphicsWindow
.
SetPixel
(
320
,
x
,
"White"
)
While
x
<
300
x
=
x
+
1
spread
=
spread
+
1
For
div
=
-
spread
To
spread
If
(
GraphicsWindow
.
GetPixel
(
320
-
1
+
div
,
x
-
1
)
=
"#000000"
)
Then
'[X][?][?]
If
(
GraphicsWindow
.
GetPixel
(
320
+
div
,
x
-
1
)
=
"#000000"
)
Then
'[X][X][?]
If
(
GraphicsWindow
.
GetPixel
(
320
+
1
+
div
,
x
-
1
)
=
"#000000"
)
Then
'[X][X][X]
GraphicsWindow
.
SetPixel
(
320
+
div
,
x
,
"Black"
)
Else
'[X][X][ ]
GraphicsWindow
.
SetPixel
(
320
+
div
,
x
,
"White"
)
EndIf
Else
'[X][ ][?]
If
(
GraphicsWindow
.
GetPixel
(
320
+
1
+
div
,
x
-
1
)
=
"#000000"
)
Then
'[X][ ][X]
GraphicsWindow
.
SetPixel
(
320
+
div
,
x
,
"Black"
)
Else
'[X][ ][ ]
GraphicsWindow
.
SetPixel
(
320
+
div
,
x
,
"Black"
)
EndIf
EndIf
Else
'[ ][?][?]
If
(
GraphicsWindow
.
GetPixel
(
320
+
div
,
x
-
1
)
=
"#000000"
)
Then
'[ ][X][?]
If
(
GraphicsWindow
.
GetPixel
(
320
+
1
+
div
,
x
-
1
)
=
"#000000"
)
Then
'[ ][X][X]
GraphicsWindow
.
SetPixel
(
320
+
div
,
x
,
"White"
)
Else
'[ ][X][ ]
GraphicsWindow
.
SetPixel
(
320
+
div
,
x
,
"Black"
)
EndIf
Else
'[ ][ ][?]
If
(
GraphicsWindow
.
GetPixel
(
320
+
1
+
div
,
x
-
1
)
=
"#000000"
)
Then
'[ ][ ][X]
GraphicsWindow
.
SetPixel
(
320
+
div
,
x
,
"White"
)
Else
'[ ][ ][ ]
GraphicsWindow
.
SetPixel
(
320
+
div
,
x
,
"Black"
)
EndIf
EndIf
EndIf
'Interesting results:
'BWBBWBWB
'BWWBWBWB
EndFor
EndWhile
Copyright (c) Microsoft Corporation. All rights reserved.