Helpline Issue 11 Contents Issue 12

mind games



10  FAST
20  INPUT M
30  IF M<3 THEN
 GO TO 20
40  LET L=INT (M/2)-1
50  LET Q=-INT(-SQR M)
60  DIM P$(L)
70  LET T=3
80  LET S=6
90  LET N=3
100 LET M=1
110 FOR I=(M+M)*(M+1)
 TO L STEP N
120 LET P$(I)="X"
130 NEXT I
140 FOR M=M+1 TO L
150 IF P$(M)="X" THEN
 NEXT M
160 IF M=L+1 THEN GO TO
 220
170 LET N=M+1
180 LET T=T+1
190 LET S=S+N
200 IF N<Q THEN GO TO
 110
210 NEXT M
220 PRINT "NUMBER OF
 PRIME NUMBERS=";T,"SUM
 OF PRIMES==";S
230 SLOW

Philip Joy sorts through his postbag and finds a chess cassette which speaks

Good response to first puzzle

THERE was a fantastic response to my first puzzle. Many correct answers and only a few incorrect ones. I will include the best program with respect to size, technique, and speed. It was sent by W E Thomson, of Suffolk. While most took six to 10 minutes, this took only one minute five seconds.

There was a mistake on my part to the solution given last month; it should be 1,548,137. To use the program it should be typed into a ZX-81 but it should work on a Spectrum. When it is run the highest number to test is required; in the puzzle case that is 5000. The program will then sum all prime numbers below that number (as shown on the left).


'A very good way of testing programs is to find in how many moves mate can be achieved. It is easy to create a mate problem and gives the most accurate check'

There was a program sent by B C Woodrow of Dorset. He says he has had his ZX-81 only since September and while not the best version, it was very good.

The Quicksilva 48K Spectrum chess program has been sent. It seems to have some space age theme about it, as the short story with it is like a science fiction story. The game has speech, something you may or may not be able to hear. It also has six levels of play, analysis of moves, and a save game option. The game, called the Chess player, is available from Quicksilva Ltd, Southampton.

Now to a letter first mentioned a few months ago from Simon Gross of Ipswich. He says that to put a chess program through tests, to see how good it is, is best done by recording results, as opposed to studying the program. Studying a program of 9K machine code is not a very easy task. It is a very skilled job to look objectively at the skill sector of a chess game, let alone unravel the machine code as well.

Recording results about the look ahead and speed is much easier. I must agree that very few people could look at so much machine code and decide how a game will play.

Gross suggests mate in so many moves type of problem, so that the program has to look ahead; the better programs will find mate easier and earlier. That is a very good way of testing programs and anyone can create a mate problem. The time it takes to work out the problem, if it does, is noted. That will give the most accurate check on chess games the average person can do.

It may give you some insight into how to beat your version of chess in the end-game. If you make up the problems, your own game will be improved. Different versions will act differently, so you can try it on all your versions. If you discover anything interesting, send the details.

For this month's puzzle I have devised a cunning maths problem: 1.2.3.4.5.6.7=16 5/6 or 16.833333

The dots are either +,-,* or /, but which is which? The idea is to get your ZX-81 or Spectrum to find what each individual dot is. The program must work out the answer. Send the answers and program, again no prizes, but the best one will be published in a future issue. Remember that 1+2*4 is 9 and not 12, i.e., multiplication first.



Helpline Issue 11 Contents Issue 12

Sinclair User
February 1983