Small Basic : Microsoft's Basic Programming Language for everybody

Small basic sample program

I discovered Small Basic new and I liked very much. It's structure and syntax are very similar to old fashion Basic interpreters like in 80's.

You can check the commands and download Small Basic from this links: 

Commands: https://smallbasic-publicwebsite.azurewebsites.net/docs/Controls

Download: https://smallbasic-publicwebsite.azurewebsites.net/assets/SmallBasic_v1.2.msi

Tutorials and document: https://smallbasic-publicwebsite.azurewebsites.net/resources

I made a small and basic Procedural Drawing program via Small Basic.

You can reach the code from Small Basic cloud via >>> http://smallbasic.com/program/?BFNK818.000

Also I added to end of this article.

But if you don't want to struggle the code, you can download the exe file from >>> https://drive.google.com/file/d/1x5-wN4Icx8iMn_7smzjN1TSwnnSE_raX/view?usp=sharing

When you run the program, it asks 2 seed numbers. They must be between 0-255.

Then it asks for the length of each step of the Turtle. It must be equal or bigger than 1. I suggest smaller values (like 1,2,4,8) for unzoomed and curved lines, bigger values (like 32,64,128) for zoomed but more linear lines.

Last input it asks is width of the pen. It must be equal or bigger than 1. For detailed view I suggest 1 or 2, for thick lines use bigger thicknesses...

For taking screenshot; just click on the program's window and press any key. This will hide the turtle. Click to button for returning back.

Have fun! And if you improve it please share...

 

This is the code:

zero:
GraphicsWindow.Width=640
GraphicsWindow.Height=480
Turtle.Speed = 10
'Input seeds and step length
'  angle seed 1:
TextWindow.Show()
TextWindow.WriteLine("Enter Angle Seed #1 (0-255):")
don1=TextWindow.Read()
' angle seed 2:
TextWindow.WriteLine("Enter Angle Seed #2 (0-255):")
don2=TextWindow.Read()
'color seed 1
renk1= MATH.Remainder(don1*don2,256)
'color seed 2
renk2= MATH.Max(DON1,don2)-MATH.Min(DON1,don2)
'draw step length:
TextWindow.WriteLine("Enter Step Length:(1-99)")
adim1=TextWindow.Read()
'draw step length:
TextWindow.WriteLine("Enter Pen Width:(1-16)")
penw=TextWindow.Read()
TextWindow.Hide()
turtle.X=GraphicsWindow.width/2
turtle.Y=GraphicsWindow.Height/2
GraphicsWindow.Title="Turtle the procedural painter | seeds: "+don1+" & "+don2+" | step:"+adim1+" | pen:"+penw
GraphicsWindow.PenWidth=penw
'procedure loop
start:
GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(renk1,renk2,don2)
Turtle.Move(adim1)
turtle.X=math.Remainder(turtle.X+GraphicsWindow.Width,GraphicsWindow.Width)
turtle.Y=math.Remainder(turtle.Y+GraphicsWindow.Height,GraphicsWindow.Height)
don=don1+don2
don1=don2
don2= math.Remainder(don,256)
renk=renk1+renk2
renk1=renk2
renk2=math.Remainder(renk, 256)
If don2>127 Then
Turtle.Turn(-math.Remainder(don2,128))
 else 
Turtle.Turn(math.Remainder(don2,128))
EndIf
GraphicsWindow.KeyDown=keyy
Goto start
Sub keyy
  Turtle.Hide()
  GraphicsWindow.ShowMessage("I hid!","Message from Turtle")
 Turtle.Show()
EndSub


Comments

Popular posts from this blog

Sony PlayStation 5 features and design have been announced

3D Virtual NFT Exhibition (Procedural Drawings and AI Stylizing)

Girls and Computers