Vai al contenuto

# Challenge 2013-01

### Small Challenge 1

Write a program to calculate the average of 10 random numbers (in the range 1 to 100).
Then calculate the average of 100, 1000 or more of the random numbers.
The average is just all the random numbers added together and then their total divided by the number of random numbers.

### Small Challenge 2

Write a program to display a colorful welcome message in the GraphicsWindow when a button is clicked.

### Small Challenge 3

Write a program to play ‘Happy Birthday’ or another well known tune using the Sound method.

### Text Challenge

I have a lot of Small Basic files and they are not always well named – I can sometimes remember a variable name I used in one or some other phrase, but not the file name.
Write a program that searches all Small Basic programs in a directory to find all files (and the line numbers) containing a user input text.
Basically ‘find a text’ in files.

### Physics Challenge

Write a program to reflect a light beam off a rotated surface.
Further challenge – make a game where the user must rotate the surfaces to get the beam to bounce off several surfaces and hit a target.

## Community Suggestion Challenges

By Nonki Takahashi

1] Draw a picture of any zodiac (star) sign.

2] Write a quine.  (Math Man early answer HRC429).  Can you do it without a File command that reads the file?

By Amir CPS

1] Convert a number in decimal form to the equivalent mixed number with the fraction portion reduced to lowest terms.

Sample Input:

• 2.96
• 14.2
• 5.625

Sample Output:

• 2 AND 19/20
• 14 AND 1/5
• 5 AND 5/8

2] Read a string and determine whether each left parenthesis ‘(‘ has a matching right parenthesis ‘)’.

Sample Input:

• (3 + (7 * 2) – 6)
• HELLO AND (WELCOME (TO THE) SB (FORUM)
• TODAY) IS ((SATURDAY())

Sample Output:

• MATCH
• NO MATCH
• NO MATCH

3] The 8-Queens problem in chess is to place 8 queens on a chess board such that none of the queens is threatening any of the others.  The problem is to input the 8 columns of the queens on the rows of a chess board, with 1 being the first column and 8 being the last, e.g. 1 2 3 4 5 6 7 8 means the queens are along the diagonal, which would not be a valid solution.