# Small Basic – The Physics Challenge (October Challenges)

Welcome to the monthly SmallBasic Challenge!

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.

Community Suggested Challenge 1 -by MathMan

Write a program to calculate the area of a crescent.

Community Suggested Challenge 2 -by Nonki Takahashi

Write a program to find the divisors of a given number.

Physics Challenge

Write a program to model a weight attached to one end of a spring.  The other end of the spring is stationary.

Extend to the model if you can to have several springs attached to the weight.

Excuse my crude drawing.

Graphics Challenge

Write a program where the turtle tries to follow the mouse.

For more of a challenge, don't use the Turtle.MoveTo command!

Text Challenge

Write a program to get the user to enter a number and write it out in words, for example 123 is one hundred and twenty three.

Math Challenge 1

Find all the numbers palindromic numbers less than 1000, eg. 1 131, 424 etc (the same forwards as backwards).

Math Challenge 2

Find all the 2 digit numbers that when the digits are reversed and the smaller number subtracted from the larger, the result is 36, for example 15 and 51.

To make it more complex find all the numbers less than 1000, where the difference of the reversed digits is a number entered by the user.

Do you have an idea for a future challenge? Please post it here: http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/a3431e06-2a46-416b-855f-fcda46b459ec

Thanks to...

Nonki Takahashi - For suggesting this blog idea!

litdev (MCC & Forum Moderator) - For hosting these great challenges!

Now get in there and beat the challenges! Ask questions and discuss it here: http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/a3431e06-2a46-416b-855f-fcda46b459ec
- Tall Basic Ed

1. Ray FAST says:

Something to spark discussions about "Text Challenge".  For non-native English speakers (which I am of one :), it is important to realize that there is almost no reason to find a logic for writing out numbers 1 through 20.  The English language is often illogical ðŸ™‚  Might as well use an array to store all those mappings.  After that, for multipliers of 10, e.g., 20, 30, …, 90, you can map those key numbers to arrays. After that, it's 100, 1000, 1,000,000, etc.

Many years ago, I wrote something along this line to print cheks, on dot matrix printers…  Hence, I also call this kind of problems check printing problems.

There are also a few subtleties.

– While it may be ok to say Fifteen Hundred, it's not standard.  It's also much easier to write One Thousand Five Hundred.

– Plural forms of hundred and thousand remain the same

– Usually you want to use "and" only once in the number.  For writing checks, I recall the recommendations is having "and" only between the dollar amount and cents.  Of course, this is not what this problem is asking for. But you can certainly make it more interesting.  In either case, pay attention and use only one "and".

– In check writing, usually the first letter of all words are capitalized.

And there are probably a few more corner cases once you start to do it ðŸ™‚

2. Math Man says:

I have done the Text Challenge. The import code is VMG691-3. The link is here at smallbasic.com/…/program It supports up to the hundred millions but there may be some problems with it.

3. Math Man, great job on Numbers to Text! I added it to the Program Gallery.