sticky
Challenge of the Month - December 2018

    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.

    Maths Challenge

    Write a program that outputs all possibilities to put + or - or nothing between the numbers 1,2,…,9 (in this order) such that the result is 100. For example 1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100

    Quick Text Challenges

    Write a program to enter a word or sentence, then do one of the following:

    • Find the longest word in a sentence
    • Sort the letters to print them in alphabetical order
    • Replace every letter with the letter following it in the alphabet (c becomes d, z becomes a)
    • Capitalize every vowel
    • Using the TextWindow, print each word on a new line in a rectangular frame. For example the sentence "Hello World in a frame" gets printed as:


    Harder Text Challenges

    Write a program that automatically converts English text to Morse code and vice versa

    Given two strings, write a program that efficiently finds the longest common subsequence

    Graphics Challenges

    Draw a picture of a face with eyes that blink

    Plot a graph of Sin, Cos and Tan functions

    File:Mplwp sin cos tan piaxis.svg - Wikimedia Commons

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

    Saturday, December 1, 2018 12:34 PM
    Moderator

All replies

  •                                                  Smiley mahreen miangul ID PVL264

    DecEmber 2018 should be a month of Smileys Draw a Smiley Animate a Smiley move the Smiley on window move it by ArrowKeys move the Smiley by KeyBoard by Mouse  do any thing but do it on Smiley 

                                                                                                                                            mahreen miangul

    Monday, December 3, 2018 4:58 AM
  •                                                  Smiley mahreen miangul ID PVL264

    DecEmber 2018 should be a month of Smileys Draw a Smiley Animate a Smiley move the Smiley on window move it by ArrowKeys move the Smiley by KeyBoard by Mouse  do any thing but do it on Smiley 

                                                                                                                                            mahreen miangul


    How cute Smiley!  My idea is to let Smiley eyes blinking.

    Nonki Takahashi

    Tuesday, December 4, 2018 3:32 PM
    Moderator
  • text sentence: TWP429

    Wednesday, December 5, 2018 8:30 PM
  • @Tryhest

    Minor issue:  cheating a bit by using LDText.Split, which is an extension.

    Bug:  What happens when you input "Pneumonoultramicroscopicsilicovolcanoconiosis is an obscure term ostensibly referring to a lung disease caused by silica dust, sometimes cited as one of the longest words in the English language." ;-)

    --BKB

    Wednesday, December 5, 2018 11:52 PM
  • u can improove it, that's a challenge 4 u now))

    a small upgrade: SQJ200

    • added header
    • added space combiner "_"

    • Edited by Tryhest Thursday, December 6, 2018 5:11 AM
    Thursday, December 6, 2018 4:50 AM
  • 5,4: I was unable to find an object named 'LDText'.
    Thursday, December 6, 2018 6:15 AM
  • Hi Mahreen, I added blinking animation to your program with smile: PVL264-0.

    Nonki Takahashi

    Friday, December 7, 2018 3:04 AM
    Moderator
  • Hi Brian, I could run Tryhest's SQJ200 with LitDev extension 1.2.20.0.

    Nonki Takahashi

    Friday, December 7, 2018 3:47 AM
    Moderator
  • update: GFD754

    dictionary in 3 columns

    use arrow to move up/dn

    enter to select word to explain

    Friday, December 7, 2018 6:58 AM
  • This is my solution for the maths challenge: SZP003-0.

    1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100
    1 + 2 + 34 - 5 + 67 - 8 + 9 = 100
    1 + 23 - 4 + 5 + 6 + 78 - 9 = 100
    1 + 23 - 4 + 56 + 7 + 8 + 9 = 100
    12 + 3 + 4 + 5 - 6 - 7 + 89 = 100
    12 + 3 - 4 + 5 + 67 + 8 + 9 = 100
    12 - 3 - 4 + 5 - 6 + 7 + 89 = 100
    123 + 4 - 5 + 67 - 89 = 100
    123 + 45 - 67 + 8 - 9 = 100
    123 - 4 - 5 - 6 - 7 + 8 - 9 = 100
    123 - 45 - 67 + 89 = 100
    Press any key to continue...


    Nonki Takahashi


    Saturday, December 8, 2018 9:48 AM
    Moderator
  • This is my solution for the graphics challenge "Plot a graph of Sin, Cos and Tan functions": RQX345-8.

    Screen shot of a program Graph 0.9


    Nonki Takahashi

    Saturday, December 8, 2018 4:29 PM
    Moderator
  • Maths Challenge Hints

    1. I think there are 11 solutions
    2. There are no solutions with 4 or more digit numbers
    3. The only 3 digit numbers are 4 solutions that start with 123
    Saturday, December 8, 2018 7:38 PM
    Moderator
  • Good one move the smiley on the window with the keyboard
                                                                                                     mahreen miangul
    Sunday, December 9, 2018 3:48 AM
  • This is my solution for the maths challenge: SZP003-0.

    1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100
    1 + 2 + 34 - 5 + 67 - 8 + 9 = 100
    1 + 23 - 4 + 5 + 6 + 78 - 9 = 100
    1 + 23 - 4 + 56 + 7 + 8 + 9 = 100
    12 + 3 + 4 + 5 - 6 - 7 + 89 = 100
    12 + 3 - 4 + 5 + 67 + 8 + 9 = 100
    12 - 3 - 4 + 5 - 6 + 7 + 89 = 100
    123 + 4 - 5 + 67 - 89 = 100
    123 + 45 - 67 + 8 - 9 = 100
    123 - 4 - 5 - 6 - 7 + 8 - 9 = 100
    123 - 45 - 67 + 89 = 100
    Press any key to continue...


    Nonki Takahashi


    update: formated output, a bit changed algorithm CSC525

    Sunday, December 9, 2018 6:39 AM
  • very simple ld graphs:

    LDGraphicsWindow.TransparentGW()
    GraphicsWindow.Title="graph"
    LDGraph.AutoScale="false"
    GraphicsWindow.Width=1200
    GraphicsWindow.Height=800
    GraphicsWindow.Left=65
    GraphicsWindow.Top=65
    gg=LDGraph.AddGraph(0 0 GraphicsWindow.Width GraphicsWindow.Height "" "X" "Y")
    
    for x=-720 to 720
      ss[x]=LDMath.Sin(x)*6.28
    EndFor
    
    rr=Math.Pi/180
    for x=-180 to 180
      ss1[x]=LDMath.Sinh(x*rr)*6.28
      ss11[x]=LDMath.cosh(x*rr)*6.28
    EndFor
    
    LDGraph.InteriorColour="#77ffffff"
    LDGraph.borderColour="#77ffffff"
    LDGraph.AddSeriesLine(gg "sin" ss "red")
    LDGraph.AddSeriesLine(gg "sinh" ss1 "green")
    LDGraph.AddSeriesLine(gg "cosh" ss11 "blue")
    LDGraph.ScaleAxisY(gg, -50 5 50)
    LDGraph.ScaleAxisx(gg, -720 30 720)

    Sunday, December 9, 2018 8:03 AM
  • a very good program PVL264-0 move the smiley on the screen with the keyboard and make it speak

    good luck                                                                                                    mahreen miangul

    16 hours 26 minutes ago