Small Basic - April Challenges! (no fooling)

A brand new set of challenges from litdev...

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

  1. Use the Timer event to provide a countdown with the remaining time displayed in a GraphicsWindow.
  2. Use the Mouse events to draw rectangles on the GraphicsWindow, mouse down to start the top left and mouse up to finish with the bottom right corner.
  3. Use the key events to make a 'code typewriter' that displays a different letter to the one typed using a simple conversion like reversing alphabet a->z, b->y, c-> x etc.
  4. Use the button events to display 11 buttons (0-9 and .) laid out like a number keypad to enter numbers using the mouse.

Text Challenge

  • Write a units converter program, where the user can select the units to convert and enter a value for conversion.  Perhaps lengths, weights or currency.

 

Graphics Challenge

  • Write a graphical 'dashboard' with buttons and textboxes as required to control a school bell timing system.  The resulting system should then sound a bell at the required intervals that can be configured by the interface.  The configuration(s) should be saved and loaded to a file.

 

Physics Challenge

  • Write a program to calculate the distance traveled when the user enters an acceleration profile.  For example:

2m/s/s for 5 sec, then 0m/s/s for 3 sec, then -4m/s/s for 1 sec

Answer 63m

 

Game Challenge

  • Write a vertical scrolling game with obstacles that appear from above and move down.  The player must dodge the obstacles by using arrow keys, probably just left and right.

Community Suggestions ( by Nonki )

  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.

 

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

Thanks again to LitDev for hosting this challenge!

   - Ninja Ed