-
Notifications
You must be signed in to change notification settings - Fork 0
fractal.sb
Kristian Virtanen edited this page Oct 31, 2024
·
2 revisions
// fractal.sb with C# & SmallBasicOpenEditionDll
namespace SmallBasicOpenEditionDll.Classes
{
class TestProgram
{
public static int x, y, ux, uy, r;
static void Main()
{
x = 100;
y = 100;
GraphicsWindow.BackgroundColor = "Black";
GraphicsWindow.Show();
for (x = 1; x < 100000; x++)
{
r = Math.GetRandomNumber(3);
if (r == 1)
{
ux = 30;
uy = 1000;
}
else if (r == 2)
{
ux = 1000;
uy = 1000;
}
else
{
ux = 150;
uy = 30;
}
x = (x + ux) / 2;
y = (y + uy) / 2;
GraphicsWindow.SetPixel(x, y, "LightGreen");
}
}
}
}
' fractal.sb in orig. SmallBasic
GraphicsWindow.BackgroundColor = "Black"
x = 100
y = 100
For i = 1 To 100000
r = Math.GetRandomNumber(3)
ux = 150
uy = 30
If (r = 1) then
ux = 30
uy = 1000
EndIf
If (r = 2) Then
ux = 1000
uy = 1000
EndIf
x = (x + ux) / 2
y = (y + uy) / 2
GraphicsWindow.SetPixel(x, y, "LightGreen")
EndFor