none
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

    Tuesday, December 11, 2018 11:37 AM
  • Good one move the smiley on the window with the keyboard
                                                                                                     mahreen miangul

    Hi Mahreen, the new version is here: PVL264-1.

    Nonki Takahashi

    Wednesday, December 12, 2018 2:46 PM
    Moderator
  • Thanyou Nonki
                                                                                                                               mahreen miangul
    Thursday, December 13, 2018 5:35 PM
  • a very good program PVL264-0 move the smiley on the screen with the keyboard and make it speak

    good luck                                                                                                    mahreen miangul

    In the new version PVL264-2, smileys may say "Hello!".  Find the places to make them speak.

    Screen shot of a program Smiley Animation Chistmas Version

     

    Nonki Takahashi

    Sunday, December 16, 2018 8:07 AM
    Moderator
  • thanks for ID PVL2-2--- Smiley should say Hallo in Audio

                              with best wishes                                                        mahreen miangul                                       

    Monday, December 17, 2018 3:23 AM
  • This is my solution for the graphics challenge "Draw a picture of a face with eyes that blink": HMX882-0.

    Screen shot of a program Christmas Tree 0.2


    Nonki Takahashi

    Monday, December 17, 2018 3:56 AM
    Moderator
  • This is my solution for the graphics challenge "Draw a picture of a face with eyes that blink": HMX882-0.

    Screen shot of a program Christmas Tree 0.2


    Nonki Takahashi


    updated: RRR611

    • added flashing msg on door click
    • color changes
    • compacted code
    • LD xtension required


    • Edited by Tryhest Tuesday, December 18, 2018 8:16 AM
    Tuesday, December 18, 2018 8:14 AM
  • line selector in textwindow: NNG189

    use cursors up/down to move selection, enter to select

     

    Tuesday, December 18, 2018 8:25 AM
  • with humble request i have not fully learned small basic-Extension learning are for latter so please if you are sending me a code program or making corrections in any of my program aviod extensions. when i fully learn small basic i myself will request for program extensions thank you.
    Happy New Year 2019 to all small basic                                                     mahreen miangul

    Wednesday, December 19, 2018 3:54 AM
  • Sample program RRR611-0                                                                                              mahreen miangul
    Wednesday, December 19, 2018 4:07 AM
  • with thanks a good tutorial for learners like me HMX882-0.

                                                                                                                  mahreen miangul


    • Edited by mussamaina Wednesday, December 19, 2018 4:24 AM text mistake
    Wednesday, December 19, 2018 4:11 AM
  • RRR611-0  No xtension required

                                                                                                                    mahreen miangul

    Wednesday, December 19, 2018 7:31 AM
  • chinese year display: WFN153 | QSP485


    • Edited by Tryhest Friday, December 21, 2018 4:59 AM
    Friday, December 21, 2018 4:52 AM
  • DORAEMON Chalk Colors Free Hand ID HKX686 needs editing
                                                      with thanks                                                              mahreen miangul
    Friday, December 21, 2018 4:54 AM
  • Nonki's ingenious Math Solution with GraphicsWindow.

    Only through the source code was it difficult to understand how the variations are generated via the modulo function.

    For this reason, this demo version with the Progam ID HBK028-0.

    Friday, December 21, 2018 10:28 PM
  • DORAEMON Chalk Colors Free Hand ID HKX686 needs editing
                                                      with thanks                                                              mahreen miangul

    Hi Mahreen, I tried.  The program ID is HKX686-0.

    Screen shot of a program DORAEMON


    Nonki Takahashi

    Saturday, December 22, 2018 8:23 AM
    Moderator
  • nice update HKX686-0                                                                                             mahreen miangul
    Saturday, December 22, 2018 9:35 AM
  • update wheelcat NCB529

    • zoom&rotate by mswheel
    • converted to shapes
    • ld xtension required

    Saturday, December 22, 2018 7:34 PM
  • textwindow card game: JKJ911

    Thursday, December 27, 2018 4:24 AM
  • thanks for sharing you'r information
    Thursday, December 27, 2018 5:26 AM
  • Very nice Go Fish!

    Thursday, December 27, 2018 10:49 PM
  • 2019 calendar in 10 languages: HQJ752

    • slovenian
    • croatian
    • english
    • german
    • french
    • spannish
    • russian
    • esperanto
    • chinese
    • japanese


    • Edited by Tryhest Friday, December 28, 2018 6:54 AM
    Friday, December 28, 2018 6:51 AM
  • Added Dutch: HQJ752-0

    Jan [ WhTurner ] The Netherlands

    Friday, December 28, 2018 11:02 AM
    Answerer
  • Nice Calendar!
    • Edited by cvmarus Friday, December 28, 2018 7:46 PM
    Friday, December 28, 2018 7:46 PM
  • beware of math.round behavior! it rounds to nearest even number

    (so called bankar's round):

    but in sb online it rounds zero-up (to positive side):

    math.floor rounds to the left side:

    while ceilling rounds to right side:

     
    • Edited by Tryhest Saturday, December 29, 2018 3:11 AM
    Friday, December 28, 2018 8:20 PM
  • 2019 calendar in 10 languages: HQJ752


    Nice concise efficient code.
    Friday, December 28, 2018 8:22 PM
    Moderator