EUG PD


Brainteasers 04

 
Published in EUG #55

Welcome to the fourth article which supplements two programs on the 'Arts' Menu (followed by "(BT)" in brackets). This issue presents Don't Paint The Cat and Name The Graph; fairly advanced playthings from Genevieve Ludinski that are designed for ages 7+ and 11+ respectively. The input procedures particularly on Name The Graph are cleverly orchestrated (Take a look at the code!) Note as usual that brief instructions appear on screen before each program.

DON'T PAINT THE CAT

Seems a strange title for a program. I mean, who would want to emulsion paint the family moggy anyway?

Well you see, the family have decided that you have to paint the garden fence. You lost the draw - it might have been your sister instead who had to do it, but never mind, there's always next time. Across the fence from you and your fantastic paint brush, is your neighbour's transistor. As a mental challenge you have decided to paint the fence according to the high/low pitch of your neighbour's music.

Look out for your cat. It's parked at the end of the fence!

How To Play

As the game begins you will hear just two notes to compare but, every time you get the answer correct, the next tune will have an extra note.

You will be told which two notes to compare, and you must input H or L for High or Low.

If you get it wrong, you must wait for the fence and the poor old pussy, to be painted. If you take too long to answer, the cat will wind up getting covered in paint anyway.

Press RETURN when you want a new tune.

Programming Hints

If you can work out the answer long before the cat is painted, then reduce the 50 of INKEY$(50) in line 350.

If you find that it is too difficult to tell the difference between the notes, then increase the 5 after the '*' sign in line 280.

Alternatively you can increase the time allowed to answer, or reduce the difference between the notes, by doing the opposite of what is described above.

NAME THE GRAPH

This is a game of logic. You have an aim, to find the equation of the graph that is drawn on the screen. You key in numbers to represent an equation. You can see straight away whether you are getting closer to your goal as the graph of the equation you keyed in is drawn on the screen.

By making the three numbers required larger and smaller, postive and negative, you can see how it effects the graph and hopefully, you can watch your graph getting closer and closer to the target graph until you hit it.

If you give up you will be told the answer, but don't cheat!

How To Play

All graphs drawn are of the type:

      Y=Ax^2+Bx+C

where A, B and C are constants (that is, numbers that can be positive or negative). For example, the equation might be:

      Y=-2x^2+3x-5

and in this case A would be equal to -2, B equal to 3 and C to -5.

You must key in three numbers all at once on the same line and separated by commas. Press RETURN only after you have keyed in all three numbers. In the example above, you would key in:

      -2,3,-5 then RETURN

Then the graph of this expression is drawn and you must make another guess. If you cannot guess the answer, key in:

      WHAT,IS,IT then RETURN

(remember to put in the commas) and you will be given the answer and the program ends.

If you guess the answer correctly then press ESCAPE and a new graph will be drawn.

It is more fun to find out how to do it by trial and error, but if you want a hint then this is it. (Skip the next paragraph if you do not want to know.)

If the first number (A) is positive, then the graph will point upwards (u shape), and if it is negative, the graph will point downwards (n shape).

Programming Hints

The graphs are plotted with the origin (zero, zero point) at the middle of the screen by using the VDU statement in line 50. This saves a lot of unnecessary maths.

You could make the programs easier by reducing the range of the numbers allowed. Do this by reducing the 5 in line 280 or the 9 in line 290 or both. If you want to make it very easy you can allow only positive numbers by deleting line 300.

The program uses Mode 1 to enable guessed graphs to be displayed in red, and the target graph in white. On a BBC Model A, you will need to change line 40 to Mode 1. The program then runs without colour.

Genevieve Ludinski