question

NonkiTakahashi avatar image
0 Votes"
NonkiTakahashi asked Tryhest-0660 answered

Challenge of the Month - February 2021

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic. Some will be easy, some will be hard - but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread. The only rule is that your solution must use standard Small Basic methods (no extensions).

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

We may extend these challenges over into a second month if solutions and questions are still coming in.

64856-square.png

Turtle Challenge

  1. Write a program to draw a square with Turtle.

  2. Try to change the edge length of square.

  3. Try to change the angle of the shape.


small-basic
square.png (100.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tryhest-0660 avatar image
1 Vote"
Tryhest-0660 answered Tryhest-0660 edited

25 squares at golden angle:
65508-image.png

 Turtle.Speed=10
 GraphicsWindow.BackgroundColor="teal"
 ll=140
 For xx= 1 To 25
   GraphicsWindow.PenColor=GraphicsWindow.GetRandomColor()
   ll=ll-3
   Turtle.Angle=Turtle.Angle+137.5
   For x= 1 To 4
     Turtle.Move(ll)
     Turtle.Turn(90)
   EndFor
 EndFor







image.png (117.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tryhest-0660 avatar image
1 Vote"
Tryhest-0660 answered Tryhest-0660 edited

10 squares by turtle at random angle, size and color:
65496-image.png
Turtle.Speed=9
GraphicsWindow.BackgroundColor="tan
For xx= 1 To 10
GraphicsWindow.PenColor=GraphicsWindow.GetRandomColor()
ll=Math.GetRandomNumber(50)+20
Turtle.Angle=Math.GetRandomNumber(360)
For x= 1 To 4
Turtle.Move(ll)
Turtle.Turn(90)
EndFor
Program.Delay(555)
EndFor



image.png (23.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

NonkiTakahashi avatar image
1 Vote"
NonkiTakahashi answered

This is my solution:

66493-turtle-regular-polygon.png

 ' Turtle Regular Polygon
 ' Copyright ©︎ 2021 Nonki Takahashi.  The MIT License.
 ' Last update 2021-02-10
    
 GraphicsWindow.BrushColor = "Black"
 GraphicsWindow.DrawText(10, 10, "Distance")
 tboxD = Controls.AddTextBox(100, 10)
 GraphicsWindow.DrawText(10, 40, "Angle")
 tboxA = Controls.AddTextBox(100, 40)
 GraphicsWindow.DrawText(10, 70, "Corners")
 shpC = Shapes.AddText("X")
 Shapes.Move(shpC, 100, 70)
 n = 4
 distance = 100
 Controls.SetTextBoxText(tboxD, distance)
 angle = Math.Round(360 / n * 10) / 10
 Controls.SetTextBoxText(tboxA, angle)
 Shapes.SetText(tboxA, angle)
 Controls.AddButton("Draw", 10, 100)
 Turtle.Speed = 10
 Controls.ButtonClicked = OnButtonClicked
 Sub OnButtonClicked
     distance = Controls.GetTextBoxText(tboxD)
     angle = Controls.GetTextBoxText(tboxA)
     GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()
     Turtle.Show()
     tx = Turtle.X
     ty = Turtle.Y
     error = 100
     n = 0
     While 0.5 < error
         n = n + 1
         Shapes.SetText(shpC, n)
         Turtle.Move(distance)
         Turtle.Turn(angle)
         ex = Turtle.X - tx
         ey = Turtle.Y - ty
         error = Math.SquareRoot(ex * ex + ey * ey)
     EndWhile
     Turtle.Hide()
 EndSub



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tryhest-0660 avatar image
0 Votes"
Tryhest-0660 answered

turtle sokoban 7 levels solver: MNC941
68929-l7.png




l7.png (71.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tryhest-0660 avatar image
0 Votes"
Tryhest-0660 answered

soko 12-levels at once: XVL633


69752-skk12.png



skk12.png (326.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tryhest-0660 avatar image
0 Votes"
Tryhest-0660 answered

soko16 lvlz: DTZ190

70212-s16.png



s16.png (458.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tryhest-0660 avatar image
1 Vote"
Tryhest-0660 answered

3d trains anim: GSK298

70323-ttl.png70306-3d-train.log



note: rename log to obj file


ttl.png (52.8 KiB)
3d-train.log (608.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tryhest-0660 avatar image
1 Vote"
Tryhest-0660 answered

hexadip switch: NZR430
70889-hxx.png




hxx.png (8.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tryhest-0660 avatar image
1 Vote"
Tryhest-0660 answered

exif photo tags: SVK843

select folder to show all pics info
72653-xff.png



xff.png (55.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.