Asked by:
Challenge of the Month - March 2014

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
- Write a TextWindow program to create some random sums for the user to answer.
- Write a program to calculate the area of rectangles, triangles or circles, when the user enters their size.
- 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
- Write a program to capitalize the first letter of each word in a text.
- Write a program to delete any non alpha-numeric character from a text.
Graphics Challenge
- Write a program to simulate a barrel rolling down a slope (see game challenge).
- Draw a picture of an alien.
Game Challenge
- Write a simplified version of the Donkey Kong game - jump over barrels to get to the top.
Community Suggestions (by Zock77)
- 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)
- Make a hexadecimal dump program for UTF-8 encoded text file.
- Make a subroutine to draw polygon with given vertices.
- 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
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
- Edited by Zock77Editor Sunday, March 2, 2014 12:49 AM
Sunday, March 2, 2014 12:48 AMAnswerer -
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
- Edited by Nonki Takahashi Friday, March 7, 2014 4:27 PM broken tag
Friday, March 7, 2014 4:25 PM -
This is my first step for graphics challenge 1: FGM769.
I made a bitmap of a barrel from this output above with GIMP 2.
Nonki Takahashi
Saturday, March 8, 2014 7:01 AM -
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 -
Tuesday, March 11, 2014 4:34 PM
-
Wednesday, March 12, 2014 2:09 PM
-
Thursday, March 13, 2014 12:02 PM
-
Friday, March 14, 2014 7:05 AM
-
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 -
Monday, March 17, 2014 4:37 PM
-
Monday, March 24, 2014 8:00 AM
-
These are my ideas for a future challenge.
- 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)
- Make a chess clock.
- 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 - Comment in (restore) such like following lines in a downloaded Small Basic program.
-
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 AMCurriculum 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 -
@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 -
I uploaded latest version of game challenge: FGM769-5.
Nonki Takahashi
I featured your Donkey Kong game!
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 -
litdev, thank you for your comment. I rewrote my ideas for a future challenge.
- 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)
- Make a chess clock.
- 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
- Edited by Nonki Takahashi Friday, March 28, 2014 2:53 AM added null line
Friday, March 28, 2014 2:49 AM - Create a program to remove automatically added comments from downloaded Small Basic source program such as following manner.
-
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 -
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 AMCurriculum 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