none
Challenge of the Month - March 2014 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 SmallBasic.  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 SmallBasic 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.

    Also post feedback on the kind of challenges that you want to see more of in the future.

    Curriculum Challenges 3.3

    1. Write a TextWindow program to create some random sums for the user to answer.
    2. Write a program to calculate the area of rectangles, triangles or circles, when the user enters their size. 
    3. Write a program to round any number for 2 decimal digits (e.g. 3.1419 is 3.14, 7.1 is 7.10 and -20 is -20.00).


    Text Challenge

    1. Write a program to capitalize the first letter of each word in a text.
    2. Write a program to delete any non alpha-numeric character from a text.


    Graphics Challenge

    1. Write a program to simulate a barrel rolling down a slope (see game challenge).
    2. Draw a picture of an alien.

    Game Challenge

    1. Write a simplified version of the Donkey Kong game - jump over barrels to get to the top.


    Community Suggestions (by Zock77)

    1. Pick an extension to base a challenge off of.  Lets start with the Fremy Extension, pick an FC object and show what can be done with it.


    Community Suggestions (by Nonki)

    1. Make a hexadecimal dump program for UTF-8 encoded text file.
    2. Make a subroutine to draw polygon with given vertices.
    3. Make a subroutine to fill polygon with given vertices

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

    Saturday, March 1, 2014 2:05 PM
    Moderator

All replies

  • Text challange 1:

    TextWindow.Write("Enter the Text to change: ")
    Input = TextWindow.Read()
    'capitalize the first letter in the string'
    Text = Text.ConvertToUpperCase(Text.GetSubText(Input,1,1)) + Text.GetSubTextToEnd(Input,2)
    'capitalize all letters following a space'
    For i = 1 To Text.GetLength(Text)
      If Text.GetCharacterCode(Text.GetSubText(Text,i - 1,1)) = 32 Then
        Text2 = Text2 + Text.ConvertToUpperCase(Text.GetSubText(Text,i,1))
      Else
        Text2 = Text2 + Text.GetSubText(Text,i,1)
      EndIf
    EndFor
      TextWindow.WriteLine("Result: " + Text2)



    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11


    Sunday, March 2, 2014 12:48 AM
    Answerer
  • This is my sample for community suggestion by Nonki 1: XWT217.

    Option?
    abc
    
    
    Addr  +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F  0123456789ABCDEF
    ----  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  ----------------
    0000  61 62 63 0D 0A                                   abc??
    
    Press any key to continue...
    

    Usage: Option? [<stdin] [>stdout]


    Nonki Takahashi


    Friday, March 7, 2014 4:25 PM
    Moderator
  • This is my first step for graphics challenge 1: FGM769.

    Screen shot of a program Simple Donkey Kong 0.1a

    I made a bitmap of a barrel from this output above with GIMP 2.

    Bitmap for a barrel


    Nonki Takahashi

    Saturday, March 8, 2014 7:01 AM
    Moderator
  • This is my second step for graphics challenge 1: FGM769-0.
    This version simulates a barrel without friction.


    Nonki Takahashi

    Monday, March 10, 2014 10:18 AM
    Moderator
  • This is my latest graphics challenge 1: FGM769-1.

    Screen shot of a program Simple Donkey Kong 0.3b - just shows barrels


    Nonki Takahashi

    Tuesday, March 11, 2014 4:34 PM
    Moderator
  • This is my sample for community suggestion by Nonki 3: NZT505.

    Screen shot of a program Fill Polygon 0.1


    Nonki Takahashi

    Wednesday, March 12, 2014 2:09 PM
    Moderator
  • This is my first step for game challenge: FGM769-2.

    Screen shot of a program Donkey Kong in Smal Basic World 0.4a


    Nonki Takahashi

    Thursday, March 13, 2014 12:02 PM
    Moderator
  • This is my second step for game challenge: FGM769-3.

    Use arrow keys to move Mario.

    Screen shot of a program Donkey Kong in the Small Basic World 0.5b


    Nonki Takahashi

    Friday, March 14, 2014 7:05 AM
    Moderator
  • Here's a solution I did back in Sep 2013 to the draw an alien challenge. This one is animated and I often try out a bit extra with each challenge, so it toggles the window size.

    The lesson I learnt back then with this was to use shapes.ZOOM to animate the eyes.

    JRP437

    Friday, March 14, 2014 5:59 PM
    Moderator
  • This is my program for graphics challenge 2: LKB431.

    Screen shot of a program Aliens 0.1


    Nonki Takahashi

    Monday, March 17, 2014 4:37 PM
    Moderator
  • I uploaded latest version of game challenge: FGM769-5

    Screen shot of a program DONKEY KONG in the Small Basic World 0.7


    Nonki Takahashi

    Monday, March 24, 2014 8:00 AM
    Moderator
  • These are my ideas for a future challenge.

    1. Comment in (restore) such like following lines in a downloaded Small Basic program.
      ' The following line could be harmful and has been automatically commented.
      '   _buf = File.ReadContents(filename)
    2. Make a chess clock.
    3. Measure tempo of Sound.PlayMusic().  The tempo is assumed to be a number of times for quarter notes in one minute.

    Nonki Takahashi

    Tuesday, March 25, 2014 4:07 AM
    Moderator
  •                                           

    Shaniqua posted here: http://blogs.msdn.com/b/smallbasic/archive/2014/03/04/small-basic-challenges-of-the-month-march-2014.aspx                                   

    Fri, Mar 21 2014 8:06 AM            
                   

    Curriculum Challenge 1: BWC453

    Curriculum Challenge 2: THM877


    Ed Price, Power BI & SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

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

    Wednesday, March 26, 2014 10:40 PM
    Owner
  • @Nonki - Thanks for your challenge suggestions - variety is great and I sometimes find it hard to invent new interesting challenges at the right level.  You donkey kong is great - you have a real flair for the graphics side which I admire.

    Could you give a bit more details an you ideas 1 and 3.  I assume 2 is a countdown with display that switches between players when they hit a key (nice idea).  Thanks.

    Wednesday, March 26, 2014 11:04 PM
    Moderator
  • I uploaded latest version of game challenge: FGM769-5

    Screen shot of a program DONKEY KONG in the Small Basic World 0.7


    Nonki Takahashi

    I featured your Donkey Kong game!

    http://blogs.msdn.com/b/smallbasic/archive/2014/03/26/the-adventures-of-barrel-ape-in-small-basic-world-by-nonki.aspx

    Great job!


    Ed Price, Power BI & SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

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

    Wednesday, March 26, 2014 11:28 PM
    Owner
  • litdev, thank you for your comment.  I rewrote my ideas for a future challenge.

    1. Create a program to remove automatically added comments from downloaded Small Basic source program such as following manner.

      Before:
      ' The following line could be harmful and has been automatically commented.
      '   _buf = File.ReadContents(filename)
      After:
         _buf = File.ReadContents(filename)
    2. Make a chess clock.
    3. Create a program to measure and calculate tempo [quarter note (crotchet)/minute] of Sound.PlayMusic().  In other words, count how many quarter notes (such as "C4") can be played in a minute.

    [*] Idea 3 comes from the fact that Small Basic MML doesn't have T (tempo) command.  So T is unknown for us at this moment.


    Nonki Takahashi



    Friday, March 28, 2014 2:49 AM
    Moderator
  • Oliver Bryant completed this challenge:                                                                                          

    Graphics Challenge 1: ZBZ152

     

    He posted here: http://blogs.msdn.com/b/smallbasic/archive/2014/03/04/small-basic-challenges-of-the-month-march-2014.aspx 


    Ed Price, Power BI & SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

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

    Wednesday, April 2, 2014 2:30 AM
    Owner
  •                                           

    Shaniqua posted here: http://blogs.msdn.com/b/smallbasic/archive/2014/03/04/small-basic-challenges-of-the-month-march-2014.aspx                                   

    Fri, Mar 21 2014 8:06 AM            
                   

    Curriculum Challenge 1: BWC453

    Curriculum Challenge 2: THM877


    Ed Price, Power BI & SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

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

    Here is Curriculum Challenge 1:

    http://smallbasic.com/smallbasic.com/program/?BWC453

    It would be fun to see how fast someone could do these math problems. =^)


    Ed Price, Power BI & SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

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

    Wednesday, April 2, 2014 2:33 AM
    Owner