How to win
Home Up How to win Questions 20th Winners


This page contains predeveloped routines for BASIC

Following these links for LOGO and "C" predeveloped routines


Predeveloped subroutines

The competition rules state that you can bring into the competition a number of predeveloped input and title routines. By knowing how to use these subroutines, you will gain 10 minutes over somebody who has to write the routines, and check that they work, during the competition.

Look at the judges sheet for both part A and part B of the competition. There are a lot of marks associated with simple error checks. If you bring in your predeveloped checking input routines, look how far you are ahead already!

The following are the routines developed by Grace Yau for the 1996 competitions

Function "Title" -- This is the subroutine Title will print the information about you and your team.
Usage -- The "Title" subroutine take one parameter -- a string.
For example, Title("Prog 1 -- Not Rocket Science")
Function "MyInput" -- This is the subroutine MyInput to print out a specific prompt and check if the input from the prompt is between the minimum and maximum value. If not print out an error message. It will return a flag saying whether the input is valid or not.
Usage -- "MyInput" take 3 parameters. The first one is a prompt message(string), the second is the lower limit(integer) of the input and the third one is the upper limit(integer) of the input.
For example, MyInput("Enter a number in the range 2 to 10", 2, 10)
Function "AnOtherTry$" -- This AnOtherTry$ subroutine is ask the judges if they want to try want program again. If they choose either "y","Y","yes","Yes","YES", then the program will continue, if they chose "n","N","no","No","NO", the program will quit, otherwise it will reprompt for a valid answer.
Usage "OtherTry$" take no parameter
For example, ans$ = AnOtherTry$()

Sample solution for Section A

Prog1 "NOT ROCKET SCIENCE" -- This program is to count down a high number to zero by subtracting a number called "STEP"
Prog2 "Somebody squished my square" -- This is the main program for the prog2 - Somebody squish my square. This program is to draw 6 stars on each six lines but each line. The program will prompt for a number (spaces shift) there will be more spaces shifted than the previous line
Prog3 "Rocket square" -- This is the main program for the prog3 - Rocket Square. This program will first ask for two input - the high number to count down and a "STEP" number to subtract. Very similar to prog1, prog3 will print out stars instead of a number.
Prog4 "Have a word with you on your side" -- Prog4 is very similar to prog3. In Prog4, instead of printing the stars while counting down from the high number, it will print out a sentence which is inputted by the judges.

Sample solution for Section B

In this section YOU ARE NOT EXPECTED TO COMPLETE. Simply show the judges you know where you "are going" and you'll get top of the class

Print out the title
Ask for some input
Draw the first thing
Keep going till the time runs out -- don't worry if you don't complete
Prog5 "Wildlife" -- This is main program for prog5. Prog5 will draw a aquarium with FISH and WORM inside. The FISH and WORM will swim according to their speed.
Prog6 "COMPLETE THE SQUARE" -- Prog6 is to play "COMPLETE THE SQUARE" with the judges. The program will ask the judges for the size of the game board. Then ask for a move(2 numbers) and it will check if the pair of numbers is valid or not. Then it will check if judges has complete the square or not and count the score for JUDGE. Then it is the Computer's turn to choose a move. The program will also check if any squares have completed and count the score for COMPUTER.


Last modified: May 16, 1999 06:01 PM by M. Smith (
Copyright -- G. Yau M. R. Smith