sticky
Challenge of the Month - December 2017

    General discussion

  • 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 that will remain 'sticky' for the month.  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.

    Small Challenges

    • Write a program to output 10 randomly selected numbers between 100 and 200 (inclusive)
    • Write a program to randomly change the GraphicsWindow background color when a consonant letter is pressed.  If a vowel is pressed, then make a beep, and if any other key is pressed then end the program.
    • Write a program to draw a parallelogram outline
    • Write a program to draw a filled parallelogram

    ParallelogramGraphics Challenges

    • Draw a picture of your favourite music album cover.
    • Create a simple car that can move with arrow keys.  As a harder challenge add a trail of smoke behind the car that gradually disperses as the car moves.


    Maths Challenge

    • Write a program to get the Turtle to draw equal sided shapes with a user entered number of sides (3 to 20).
    • As a harder challenge, make sure all of the polygons have the same area.

    Polygons

    Text Challenge

    • Write a program to output some text in RTF (rich text format) format.
    • Try to change font type, size and color.
    • If you get this going, then write a small interface program to select font, size and color using buttons etc.

    Hints:

    Use wordpad to create and view rtf.  Use notepad to view the rtf format statements.

    Do you have an idea for a future challenge? Please post it here!

    Saturday, December 02, 2017 9:51 AM
    Moderator

All replies

  • Hi team,

    This is my solution for the first one of small challenges (Write a program to output 10 randomly selected numbers between 100 and 200 (inclusive))

    Program Code = DDK004

    Thanks,


    Roshan - 7th Grade Student (Age 11) - Learning Small Basic and Visual Basic

    Sunday, December 03, 2017 3:14 AM
  • Hi Team,

    This is my another solution for the first one of small challenges (Write a program to output 10 randomly selected numbers between 100 and 200 (inclusive))

    • Code simplified
    • Made using while loop
    count = 0
    While (10>count)
    num = Math.GetRandomNumber(200)
      If (num >= 100 And num <= 200) Then
        count = count + 1
        TextWindow.WriteLine(num)
      EndIf
    EndWhile

    Thanks,


    Roshan - 7th Grade Student (Age 11) - Learning Small Basic and Visual Basic

    Sunday, December 03, 2017 7:12 AM
  •                                                               mahreen miangul ID XRG002
    mahreen=420  'offset
    miangul=155
    h = 100 'Hpar=200  'height
    w = 150 '  Wpar 'sidelength
    sl=50   'slant
    GraphicsWindow.backgroundcolor = "rosybrown"
    'GW=xharoon+600+w+sl+50
    'GH=yrashid+200+h+50
    GraphicsWindow.Height=420
    GraphicsWindow.Width=1080

    '    FILL
    GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()
    s=sl/h
    For y=miangul+1 To miangul+h-1
      x=mahreen+sl-(y-miangul)*s
      GraphicsWindow.DrawLine(x+1,y,x+w-1,y)
    EndFor

    GraphicsWindow.PenWidth = 4
    'draw border last
    GraphicsWindow.PenColor= "darkslategray"
    GraphicsWindow.DrawLine(mahreen+sl,miangul,mahreen+sl+w,miangul)
    GraphicsWindow.DrawLine(mahreen+sl+w,miangul,mahreen+w,miangul+h)
    GraphicsWindow.DrawLine(mahreen+w,miangul+h,mahreen,miangul+h)
    GraphicsWindow.DrawLine(mahreen,miangul+h,mahreen+sl,miangul)
    Sunday, December 03, 2017 7:18 AM
  • Hi Team,

    This is my solution for the second one of Small Challenges(Write a program to randomly change the GraphicsWindow background color when a consonant letter is pressed.  If a vowel is pressed, then make a beep, and if any other key is pressed then end the program.)

    Program ID = LMX663

    Thanks,


    Roshan - 7th Grade Student (Age 11) - Learning Small Basic and Visual Basic

    Sunday, December 03, 2017 1:27 PM
  • Hi Team,

    This is my solution for the third one of Small Challenges (Write a program to draw a parallelogram outline)

    Program Code = HZB664

    Thanks,


    Roshan - 7th Grade Student (Age 11) - Learning Small Basic and Visual Basic


    Sunday, December 03, 2017 1:34 PM
  • Hi, Roshan - good method, can you tweek to make the sides fully parallel.  If you can then try to create a paralleogram outline that is rotated - a bit tougher!


    Monday, December 04, 2017 9:52 PM
    Moderator
  • Hi,

    Filled Parallelogram

    Program Code = NWJ478

    Thanks,


    Roshan - 7th Grade Student (Age 11) - Learning Small Basic and Visual Basic

    Wednesday, December 06, 2017 11:52 AM
  • This is my partial solution for the second challenge of the maths challenges: ZKH816.

    I could draw from triangle to octagon.

    Screen shot of a program Polygon Transformer


    Nonki Takahashi

    Friday, December 08, 2017 1:49 AM
    Moderator
  • This is my solution for the first challenge of the maths challenges: ZKQ845-0

    Screen shot of a program Turtle Polygon 0.2


    Nonki Takahashi

    Saturday, December 09, 2017 2:11 AM
    Moderator
  • This is my unique numbers version for the first challenge of the small challenges.

    While n < 10
      i = Math.GetRandomNumber(101) + 99
      unique[i] = 1
      n = Array.GetItemCount(unique)
    EndWhile
    index = Array.GetAllIndices(unique)
    For i = 1 To 10
      TextWindow.WriteLine(index[i])
    EndFor


    Nonki Takahashi


    Saturday, December 09, 2017 2:50 AM
    Moderator
  • I took the random number challenge and jumped into the deep end with it. This version displays a graph and will generate a set of random numbers in the range describe by a line sketched on a graph.

    Import Code: FHF708

    My original idea was to take advantage of all aspects of a line to describe the random number set, but in the end I could only usefully make use out of the distance between x's and the distance down the y axis. If anyone has any ideas on how to expand it I would love to hear about them.  :-)

    Saturday, December 09, 2017 10:13 PM
    Answerer
  • Hi Team,

    This is my solution for (Draw a picture of your favorite music album cover.)

    Import Code = GNT471

    Thanks,


    Roshan - 7th Grade Student (Age 11) - Learning Small Basic and Visual Basic

    Sunday, December 10, 2017 1:57 PM
  • tried drawing A in 3D ID CTL233 but result is not very good                    mahreen miangul
    Monday, December 11, 2017 5:22 AM
  • Hi Team,

    This is my solution for First one of text challenge (Write a program to output some text in RTF (rich text format))

    Import code = NPT191

    Thanks,



    Roshan - 7th Grade Student (Age 11) - Learning Small Basic and Visual Basic

    Tuesday, December 12, 2017 12:00 PM
  • This is a sample to write RTF file.  The output file can be opened with WordPad.exe.

    Program ID MPX355

    Run this program after removing comment mark of the last line.


    Nonki Takahashi

    Tuesday, December 12, 2017 1:34 PM
    Moderator
  • Nice!

    Jan [ WhTurner ] The Netherlands

    Tuesday, December 12, 2017 1:40 PM
    Answerer
  • This is my solution for the first challenge in the graphics challenges: JPM081.

    Screen shot of the program Album Jacket - LET IT BE


    Nonki Takahashi

    Tuesday, December 12, 2017 4:12 PM
    Moderator
  • Nonki - This is a great album and your drawing is really very cool!
    Tuesday, December 12, 2017 4:16 PM
    Moderator
  • Small Challenge with consonant and vowel letter : PFM113
    Thursday, December 14, 2017 10:08 PM
  • Music Album Cover challenge.

    I wanted to recreate this album cover of Joy Division Unknown Pleasures, its radio waves from Pulsar CP1919, I tried to find the data feed that I could use and understand but failed, Nevertheless I went with this idea anyway.

    Instead I converted a holiday image of my face (in dappled light) into plot-able data...

    My Graphics window output:

    Program found here: BCW046

    Used a second initial program to create the array data for the image (GVQ029), Of course this can be done in one program but to have it work online I decided to split them.


    Alex Warrington - alex.warrington@live.co.uk

    Thursday, December 14, 2017 11:43 PM
  • Great programs Alex, and Joy Division is also a fantastic choice, we now just need Deep Purple and The Clash!

    17 hours 35 minutes ago
    Moderator
  • Hi,

    These are my ideas for future challenges

    • Write a program that can load all variables (even which are used in for loop) of a file with (.sb) extension.
    • Make a simple colour slider that can select colours

    Thanks,


    Roshan - 7th Grade Student (Age 11) - Learning Small Basic and Visual Basic

    17 hours 20 minutes ago