locked
Challenge of the Month - July 2017 RRS feed

  • 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.

    Text Challenges

    • Write a program reverse all the characters in a sentence ("hello world" -> "dlrow olleh")
    • Write a program to reverse the word order in a sentence ("hello world" -> "world hello")
    • Write a program to swap pairs of characters in a sentence ("hello world" -> "ehll oowlrd")
    • Write a program to capitalise every word in a sentence ("hello world" -> "Hello World")

    Maths Challenges

    • Write a program to calculate the sum of the first 10 whole numbers (1+2+3+...+9+10)
    • Write a program to calculate the sum of the first 10 even numbers (2+4+...+18+20)
    • Write a program to calculate the sum of the first 10 odd numbers (1+3+...+17+19)
    • Write a program to calculate the sum of the first 10 numbers that are a divisible by 3 (3+6+...+27+30)
    • Write a program to calculate the sum of the first 10 numbers squared (1+4+...+81+100)

    Graphics Challenges

    • Draw a picture of your pet (or animal you would like to be your pet)
    • Draw a picture with that animates from day to night, perhaps a moving sun and moon, maybe stars gradually appearing

    Interface Challenge

    • Write a GraphicsWIndow interface using the Controls and Shapes commands with events to get the user to enter 5 numbers and get the program to calculate their sum, average, minimum and maximum values when buttons for these are pressed
    • Validate that all data is correctly entered (e.g. all data are numbers and present)

    Game Challenge

    • Write a simple platform game, where your player has to move from left to right and jump over an obstacle or gap
    • Extend as far as you can to include other features like scrolling with player, duck below objects, jump to get coins, avoid enemies etc

    Physics Challenge

    • Write a program to simulate an internal combustion engine, valves openning, piston moving and turning a crank shaft

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

    • Edited by litdev Saturday, July 1, 2017 11:53 AM
    Saturday, July 1, 2017 10:49 AM

All replies

  • day-night picture: GSK928

    Monday, July 3, 2017 6:43 AM
  • Picture of my pet: GWD549.

    Screen shot of a program Toy Poodle


    Nonki Takahashi

    Monday, July 3, 2017 9:27 AM
  • Other colors added: GWD549-1.

    Screen shot of a program Toy Poodle 0.3


    Nonki Takahashi

    Monday, July 3, 2017 12:44 PM
  • nice dogs nonki))

    updated: GWD549-2

    • code reduced
    • colors changed
    • removed debug and back rectangles

    Monday, July 3, 2017 5:14 PM
  • My engine is VGP225.

    Best Regards Martin

    Wednesday, July 5, 2017 3:15 PM
  • hello i have tried to draw Kiwi program ID GKP920 but could not draw the feet properly need some help Thnkyou

                                                                          mahreen miangul

    Thursday, July 6, 2017 3:36 AM
  • the small basic forum as litdev and also microsft puts it is for learning small basic and guiding us to code programming
     using small basic we are geting answerd at your own convinense and you take very long to answer and at time we dont get answerd
    you gurus put good programs which increases your coding skeels but are of no use to a biginer learning to program. 
    microsoft has a long list of program online which are suficent to learn programming but we come to small basic forum for 
    guidence and to get our programs edited and get our mistakes corrected i hope i am not saying to much and hope microsoft 
    and the forum will guid and help i started with small basic as it is an excelent language and the best part of it is if one
     has a good mathimatical knowledge then the language becomes very easy with thanks and excuse 

                                                                                                 mahreen miangul
    Friday, July 7, 2017 11:32 AM
  • This is my solution for the interface challenge: XWD558-0.

    Screen shot of a program Interface Challenge


    Nonki Takahashi


    Friday, July 7, 2017 3:41 PM
  • the small basic forum as litdev and also microsft puts it is for learning small basic and guiding us to code programming
     using small basic we are geting answerd at your own convinense and you take very long to answer and at time we dont get answerd
    you gurus put good programs which increases your coding skeels but are of no use to a biginer learning to program. 
    microsoft has a long list of program online which are suficent to learn programming but we come to small basic forum for 
    guidence and to get our programs edited and get our mistakes corrected i hope i am not saying to much and hope microsoft 
    and the forum will guid and help i started with small basic as it is an excelent language and the best part of it is if one
     has a good mathimatical knowledge then the language becomes very easy with thanks and excuse 

                                                                                                 mahreen miangul

    Thanks Mahreen!

    Ed Price, Azure Development Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Wednesday, July 26, 2017 6:27 PM
  • This is my solution for the first one of the text challenges.

    txt = "hello world"
    Reverse()
    TextWindow.WriteLine(txt)
    
    Sub Reverse
      tmp = ""
      len = Text.GetLength(txt)
      For p = 1 To len
        c = Text.GetSubText(txt, p, 1)
        tmp = Text.Append(c, tmp)
      EndFor
      txt = tmp
    EndSub


    Nonki Takahashi

    Friday, July 28, 2017 1:45 AM
  • This is my solution for the third one of the maths challenges.

    TextWindow.Title = "The sum of the first 10 odd numbers"
    sum = 0
    n = 1
    For i = 1 To 10
      If 1 < i Then
        TextWindow.Write("+")
      EndIf
      TextWindow.Write(n)
      sum = sum + n
      n = n + 2
    EndFor
    TextWindow.WriteLine("=" + sum)


    Nonki Takahashi


    Friday, July 28, 2017 1:54 AM
  • This is my solution for the last one of the maths challenge.

    Init()
    TextWindow.Title = title
    Calc()
    
    Sub Init
      title = "The first 10 numbers squared"
      sum = 0
    EndSub
    
    Sub CallBack
      n = i * i
    EndSub
    
    Sub Calc
      For i = 1 To 10
        If 1 < i Then
          TextWindow.Write("+")
        EndIf
        CallBack()
        TextWindow.Write(n)
        sum = sum + n
      EndFor
      TextWindow.WriteLine("=" + sum)
    EndSub


    Nonki Takahashi

    Friday, July 28, 2017 2:10 AM
  • This is my solution for the last one of the text challenges.

    txt = "hello world"
    Capitalize()
    TextWindow.WriteLine(txt)
    
    Sub Capitalize
      buf = txt
      txt = ""
      p = 1
      len = Text.GetLength(buf)
      While p <= len
        GetToken()
        Cap()
        txt = Text.Append(txt, tok)
      EndWhile
    EndSub
    
    Sub GetToken
      c = Text.GetSubText(buf, p, 1)
      tok = c
      p = p + 1
      IsSpace()
      sp1 = sp
      While (p <= len) And (sp1 = sp)
        c = Text.GetSubText(buf, p, 1)
        tok = Text.Append(tok, c)
        p = p + 1
        IsSpace()
      EndWhile
    EndSub
    
    Sub IsSpace
      If c = " " Then
        sp = "True"
      Else
        sp = "False"
      EndIf
    EndSub
    
    Sub Cap
      tmp = Text.ConvertToUpperCase(Text.GetSubText(tok, 1, 1))
      tmp = Text.Append(tmp, Text.GetSubTextToEnd(tok, 2))
      tok = tmp
    EndSub


    Nonki Takahashi


    Friday, July 28, 2017 3:08 AM
  • This is my solution for the game challenge: Platform Game Sample 0.5b.

    But not simple?

    Screen shot of a program Platform Game Sample 0.5b


    Nonki Takahashi

    Friday, July 28, 2017 5:02 AM