# Challenge of the Month - August 2016

• ### 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 Challenge

Write a program to perform a 'find and replace' feature for text in a file.

Maths Challenge

Write a program to calculate display numbers with either a fixed number of significant figures or fixed number of decimal places.

Game Challenge

Write a breakout type game

Check out the Community Suggestion Challenges also made sticky for a month

• Optical Illusions (By Yvan) - LINK
• Avatar Generator (By Nonki) - LINK
• The Kodalith effect (By Yvan) - LINK

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

Monday, August 1, 2016 8:46 AM

### All replies

• program no : BQT169

section: Maths Challenge

Write a program to calculate display numbers with either a fixed number of significant figures or fixed number of decimal places.

This program calculate the force gravity of the Earth on the Moon, displays the gross result in conditions that Small Basic allows, then with this program, he converted this huge number in scientific notation in power of 10 with 3 decimal places like precision.

Wednesday, August 3, 2016 4:55 PM
• puzzle game:CQK281
Thursday, August 4, 2016 6:58 AM
• Maths Challenge

Write a program to calculate display numbers with either a fixed number of significant figures or fixed number of decimal places.

This is my solution for this challenge:

```v = 9
n = 99
While n * 1 = n
v = n
n = Text.Append(9, n)
EndWhile
TextWindow.WriteLine(v + " is valid number.")
TextWindow.Write("The fixed number of " + v)
TextWindow.WriteLine(" is " + Text.GetLength(v) + ".")

v = 0.1
n = 0.01
While n * 10 = v
v = n
n = Text.Append("0.0", Text.GetSubTextToEnd(n, 3))
EndWhile
TextWindow.WriteLine(v + " is valid number.")
TextWindow.Write("The fixed number of decimal places in " + v)
TextWindow.WriteLine("is " + (Text.GetLength(v) - 2) + ".")```
Make sense?

Nonki Takahashi

Monday, August 8, 2016 7:10 AM
• This is my first step for game challenge (breakout game): SNZ703.

Nonki Takahashi

Thursday, August 11, 2016 10:01 AM
• @Nonki,

great game, perfect simulation !!

Friday, August 12, 2016 3:01 PM
• I love the idea of monthly challenge in the forum ;-)

It is always good idea to follow the new Forum Ninjas blogs :-)

Thursday, August 18, 2016 3:46 AM
• Hello pituach,

you can check all challenges here.  Thanks.

Nonki Takahashi

Wednesday, August 24, 2016 2:22 AM
• I found a similar (not exact) solution for the text challenge (find and replace): XMG163-1.

Usage:

Option? from to[<input][>output]

Option? abc cba
abcdefg

Option? Text Test<tr02.sb
' tr - translate command 0.21
'
' History:
'  0.21 2014-02-19 Minor changed for Silverlight. (XMG163-1)
'  0.2 2014-02-19 Completed. (XMG163-0)
'  0.1a 2014-02-18 Created as alpha version. (XMG163)
'
Not = "False=True;True=False;"
WQ = Test.GetCharacter(34)
TestWindow.Write("Option? ")
ParseArgs()
string[1] = args[1]
string[2] = args[2]
EspandStr()
eof = "False"
nLine = 0
nChar = 0
If args["stdin"] <> "" Then
mas = 0 ' dummy for remote