Micromail

Volume 2

Number 2

April 1984

You just can't keep up with progress . . .

I must confess I enjoyed R.D. Jackson's arrant nonsense (Micromail, February 1984) for what it was.

I trust that when he buys a car and finds later the manufacturers bring out a facelifted version, he takes his car back to the garage and demands a replacement free of charge on the grounds that his first car was inadequate.

Come off it, Mr Jackson. Surely you realise that the world of microelectronics is changing rapidly.

What is conceived today, manufactured tomorrow, and sold the next day can easily be out of date by next week. Long live progress! - Richard Grant, Newcastle upon Tyne.

Chess gambits

REGARDING the article "Chess for Three" in the December 1983 issue of The Micro User. As the author of White Knight, I was pleased to see that Mr Bell gave the "best program" verdict to White Knight.

However there were several errors in the article which I would like you to correct for your readers.

• White Knight is quite capable of doing the KR v K ending on higher levels.

• White Knight plays the first five moves of the endgame study perfectly and sees the stalemate at move seven.

If it searched the rook underpromotion it would easily see the win at move six and thus play the whole study perfectly.

It can also understand all draws by repetition perfectly, rather than the crude understanding Mr Bell assumed.

• He concluded from the tests that White Knight and Acornsoft Chess were roughly equal in playing strength. This is ridiculous.

In a series of games played between the programs on various levels, White Knight beat Acornsoft by 16 games to nil.

This shows White Knight to be at least 700 ELO points stronger, obviously several classes above the others. White Knight also proved itself by winning the home micro section of the '83 European Championships.

Mr Bell should not try to judge playing strength from the results of a few obscure tests. You must play a long series of games to get the overall truth.

• He states that micro programs are still 10 years behind mainframes. The best micros can now play at around 1700-1800 ELO outstripping any mainframe of 1974.

If it were not for the modern mainframes' phenomenal speed they would be no better than current micro programs. I would like to see any mainframe program play the best micros on similar hardware or with fair handicapping. - M.P. Bryant, Basingstoke, Hants.

• My biggest error was to quote White Knight's price without VAT. Taking his points in order:

• True, but I only tested at one minute per move.

• This is a test repetition, stalemate and underpromotion. White Knight does not consider underpromotion.

Also I do not believe White Knight can "understand all draws by repetition perfectly" because of the overheads involved in matching positions back almost 50 moves when searching ahead, plus whether castling and en passant was relevant.

• From the tests the two programs appeared roughly equal.

• No chess program without book openings or end game knowledge can be sensibly rated on the ELO scale. If it played against me, then its rating would quickly drop down to mine (which is lousy) and it would have been slaughtered by either Chess 4.0 or Kaissa in 1974 which were rated then at about 1750 against human players.

Also 10 years ago the real skill of chess programming lay partly in getting the very expensive machine time so the mainframe's power was almost completely offset by the fact that the programs were only tested for a few hours and had to be written in high level languages to help understand and debug the errors quickly.

I have responded because I am happy to re-publicise Mr Bryant's excellent program. It was easily the best of the three, but he might be less irate if he read my book "The Machine Plays Chess?" about some of the difficulties which beset the early chess programmers.

In particular consider chapter seven - the story of Cojones, the last word on the subject of the KR v K ending.

A.G. Bell

Barrel Battle upgrade

I THOROUGHLY enjoyed Barrel Battle, the game of the month in your January issue.

However, I find the "super barrel" feature when two barrels land on top of each other and wipe out ladders, didn't give a person of mature years such as myself enough scope - I was always in the wrong place for the incomplete ladders!

So I've modified the codes, as enclosed. It may not be very elegant, but at least it works - and, I think, gives a more enjoyable game! - Andrew Tormell, Wigan.

37 R%(I%)=32:IFPOINT( (A%(I%)+D%(I%))*64+8,(33 -B%(I%))*32-4)=6 OR POIN T((A%(I%)+D%(I%))*64+8,( 31-B%(I%))*32-4)=6 ORPOI NT((A%(I%)+D%(I%)1*64+8, (33-B%(I%))*32-16)=7 OR POINT((A%(I%)+D%(I%))*64 +8,(31-B%(I%))*32-16)=7T HENR%(I%)=225:T%(I%)=6

Top of the pops?

IN the autumn of 1982 Laser-bug included a questionnaire in the magazine and accordingly printed the results in the magazine. In the winter of 1983, we carried out a similar questionnaire.

However this year, instead of simply printing the results in the magazine, we thought it would be a nice idea to award the top three answers in suitable categories an award in the form of a certificate.

The categories include, for instance, "Best piece of BBC Micro software". The two categories that are relevant to this letter however are "Favourite BBC Micro magazine" and "Most highly thought of BBC Micro magazine" (the final names of the categories are still to be decided).

Although we will not be releasing the results for a couple of weeks yet, The Micro User has come somewhere in the top three in both categories and hence should receive a certificate.

However the fact that The Micro User refuses to allow ourselves and Beebug to advertise in your magazine for no, as yet, stated reason (despite I note allowing Beebug/Elbug to attend the recent Micro User show?) would point to a possibility of yourselves not accepting the award.

I cannot at this stage be exact, but The Micro User has definitely come somewhere in the top three places in both categories.

I would like to know whether or not The Micro User will be prepared to accept the awards. If so then all well and good, it will be added publicity to your magazine.

If not then by default your awards will go to whoever is in the next position.

I would be grateful if you could inform me whether or not you will be prepared to accept the certificates by Tuesday, February 14. If I do not hear from you by that time I will assume that you are not prepared to accept them. - Paul Harbour, Editor, Laserbug, Slough.

Frustrated subscriber

I AM, it would appear, in the unfortunate situation of being a subscriber to the Laserbug user group.

Although, as I understand, you do not accept advertisements from this organisation, there may be many of your readers who are considering joining Laserbug after seeing glamorous claims elsewhere in the computing press.

You may consider it pertinent to advise such readers of my unfortunate experiences as this may flavour their decision.

My 1983 supply of the Laserbug magazine dried up three months prematurely and my 1984 subscription seems to have disappeared into their bank account without producing any return.

Numerous telephone calls and visits to their trading address have, until now, only yielded further frustration and promises of a refund which never materialised.

It was interesting to meet during one visit to their premises some representatives of another organisation also seeking compensation and the reclamation of some expensive equipment.

In the rapidly expanding business of home computing many organisations come and go, the substandard elements gravitating into oblivion in the face of competition from the competent.

As a prominent member of the latter group I trust you will deem fit to warn the unsuspecting of the possible disappointment associated with joining the subject user group. - K.R. Derbyshire, Wassenaar, Netherlands.

Bright ideas

I HAVE only had my Beeb for a few weeks and am still ploughing my way through the Basic manual. Obviously not advanced enough to enter the competitions yet!

Do you pay for ideas for competitions? That would be nice! Here are a couple, anyway. D A competition to invent the best birthday card - flowers growing or what-have-you, with appropriate jingles as well!

This might appeal to programmers at all levels of expertise and also help to butter

up computer widows/widowers on special occasions. D How about a competition to see who could invent the best competition? Winning entries would, naturally, be used in future issues of The Micro User.

If you use my second idea perhaps I can submit the first one! - Julie Switsur, Sydenham.

• We gave this to the editor, but the last line sent him into an infinite loop, so he can't reply.

Anyway we're always grateful for competition ideas.

Hang on a tick . . .

I AM writing to give you a correction for Hangman which appeared in the December 1983 Electron User. Line 170 should read as follows:

170 IF word$=STRING$ (length%," ") THEN PROCwon ELSE IF correct%=TRUE THEN 80 ELSE err%=err%+l :PROChang :IF err%<8 THEN 80

- B.P. Scddon, Hampton, Middlesex.

• Quite correct. A number of readers spotted this error. Our apologies.

Not into orbit

IS there a difference between the Electron and the BBC B which has not been mentioned?

I typed in "Electron Orbit" from the January Micro User on my BBC B (1.20 OS Basic I DFS) and got "Division by 0 in line 480".

This is obvious as in line 470 we are defining X = 500*COS(I%*PI/20) when in 460 we have 1% = 0 to 40.

As when 1% = 10 X = 500COS(10*PI/20) which is 0 as COS (PI/2) = 0.

Strangely enough, this doesn't occur at I% = 30 as 30* PI/20 has a slight error and produces a number of the order IE-10

The cure is:

475 IF X=0 THEN X=1E-10

- Ian Gustard, Westerhope, Newcastle upon Tyne.

• You've come across one of the differences between Basic I and Basic II - their mathematical routines are handled in different ways.

This is because the ZX81 was found to have better mathematics than Basic I, so Basic II was commissioned.

Thanks!

MANY thanks for your letter, I typed REPORT as you suggested and got Copyright 1982, so I am relieved to know that I have Basic II.

I was tempted to tell you I had Basic III for a moment, but I could not have sustained it!

I tried your suggestion of re-typing the program using 'l' (small L) instead of figure '1' when in doubt, and lo! it worked.

Sorry to have been so stupid -but it really is not very clear, is it? Anyway, I shall not make that particular mistake again.

I am grateful to you for taking the time and trouble to reply to my queries. Good luck with the magazine. - I.R. Phelps, Peacehaven, East Sussex.

Character store

I AM taking O level computer studies at school and for my project I am doing a character generator which lets you enlarge characters from ROM and change them with the help of *FX20,1 and a little assembly in the program.

When I've changed the characters, I want to save them on disc or tape but don't know how to do this. Can you please help me? - D. McAllister. P.S. Your London Micro Show was top class.

• We've yet to read anything which fully explains where the character set is stored after a *FX20,1.

In simple terms the OS states Ascii codes &AO - &BF after a *FX20,1 at the OSHWM or operating system high water mark.

OSHWM is normally set to the value of PAGE, but after this call, PAGE is incremented by 256, that is if PAGE = &EOO then PAGE = &FOO.

So all you have to do is Print PAGE and then *SAVE the memory between the normal value of PAGE and its new value.

For example: for OS 1.2 tape system PAGE=&E00, after *FX20,1 PAGE=&F00 so *SAVE "CHAR_CODES" E00 EFF and *SAVE "CHAR_CODE2" C00 CFF.

&C00 - &CFF is where the Ascii codes &80-&9F reside, and &E00 - &EFF is where the Ascii codes &A0-&BF reside.

In normal circumstances, or after *FX20,0, &C00 -> &CFF contains the Ascii codes &E0 -&FF.

Socket snag

I AM writing to inform your readers of a problem I recently had with my BBC Micro.

While running programs I kept getting spurious inputs from the keyboard.

This only occurred intermittently but when it did happen, it occurred several times before going away again.

Eventually the fault could be provoked by tapping the upper casing, and I therefore decided to investigate inside.

I found that the multiway ribbon cable between the keyboard and the main PCB was loose at the PCB end.

Accordingly I tried to push it home but found that I couldn't.

On looking closer, I saw that the ribbon cable connector had a moulding on the aide.

This moulding was in fact directly over the narrow edge of an adjacent socket, that is on the PCB, thus preventing it from being pushed fully home.

I found that by slightly bending the keyboard ribbon connector assembly away from the socketed IC, I could push the connector fully home.

Since doing this I have not had any further problems. I felt this may be of interest to others who may have experienced similar problems.

It does seem to have been caused by the closeness of the keyboard connection to the socketed IC. - Peter McKain, Northallerton.

Game for a cousin

A FEW days ago my little cousin came around, saw the computer, and said: "Can I play a game?" I didn't think "Swoop" or "Sphinx Adventure" would quite amuse her, so I thought back to my quickest programming tech-

niques and typed in the program listed below. - Clive Gringras, Cheadle, Stockport.

• This seems such an ideal program for April Fools Day, we can't resist printing it!

10 A=RND(2)
20 MODE 7
30 PRINT ''''"IN MY MEMORY I HAVE" 32 PRINT "MILLIONS OF DIFFERENT OBJECTS'
40 PRINT "I'M THINKING OF ONE NOW..."
41 PRINT "CAN YOU GUESS IT?"
50 PRINT "ALL YOU HAVE TO DO IS ASK A QUESTIO N.."
60 PRINT "e.g. CAN IT SWIM. I ANSWER YES OR NO"
70 PRINT "START TO GUESS"
80 INPUT G$
90 IF G$="" THEN PRINT "WELL DONE!" : GOTO 150
100 IF A=l PRINT "YES"
110 IF A=2 PRINT "NO"
120 A=RND(2)
130 GOTO 80
150 PRINT "ANOTHER?"
160 A$=GET$
170 IF A$="N" THEN GOTO 180 ELSE GOTO 70
180 END

Strictures on structures

AS a professional systems programmer it saddens me to see yet more letters criticising structured programming from well-meaning people who obviously haven't the faintest idea what structured programming is.

May I attempt to enlighten them?

Structured programming is a program design technique which is based on two separate but related principles.

The first is the idea of a "proper program", which is any section of code having one entry point and one exit point.

A BBC FN, PROC, or even a set of lines which are GOSUBd are all examples of proper programs (unless you want to argue that multiple ENDPROCs or RETURNS are not functionally equivalent to a single exit point).

The second is the structure theorem. This grew from the realisation that the vast majority of program errors arise from a faulty flow of control through the program.

If a set of ground rules for defining program flow could be established it was argued that programs would be easier to design, code, understand and maintain.

And with the bonus that far fewer errors would occur in program flow, and those which did would be much easier to find and correct.

The structure theorem states that any program (in any language, except "parallel" languages such as ADA) can be written using just three forms of construction:

Sequence - A proper program whose instructions are obeyed in the same order in which they are physically written.

Selection - Two or more proper programs, only one of which is executed depending on the result of one or more tests (for example: IF-THEN - ELSE).

Iteration - A proper program which is executed a fixed number of times, or a proper program which is executed repeatedly until a condition becomes true, for example: FOR-NEXT, REPEAT-UNTIL.

No one has yet managed to disprove the structure theorem.

A program designed according to these rules is a structured program. You may design it using flowcharts, pseudocode or anything else.

While I would be the first to admit that structured programming is not essential for all programs, the larger the program the more valuable the technique becomes.

In fact most DP departments insist on the use of structured programming.

What your correspondents are bickering about is not structured programming, but how one physically codes a program, which is hardly the same thing.

For myself, I will stick to meaningfully-named PROCs and FNs which I will probably still understand if I need to amend the program in a year's time.

Preferable to having to find line 8560 to find out what on earth the code there does, particularly since the Renumber command cannot handle 100 per cent of line number references (look up page 336 of the User Guide if you don't believe me).

Incidentally if you follow the structured programming rules you will find that GOTO is not required except in a few rare cases.

In languages such as Pascal, which have definite rules about where you may and may not GOTO, this is just as well.

So please, argue about GOTO and GOSUB if you like, but don't confuse that argument with structured programming! - Cad Delworth, Edinburgh.

And finally, with tongue firmly in cheek . . .

The Archers will never seem the same again

Dear Trev,

Things go from bad to worse. I got home the other night and Andrea dropped a bombshell.

"Don't forget you're being recorded for the BBC tonight".

"What?" I asked, wondering if this meant she'd promised Nigel the loan of my cassette recorder. Again.

"You're being recorded for 'On Your Shoulder' tonight. Dirk, the producer, saw that bit in the paper and rang asking if you'd repeat it on radio. I knew you'd agree, so I said yes for you ".

"Why didn't you tell me?" I shrieked.

"I meant to, but you'd have only got nervous. Anyway you ramble on about micros for hours so why should you shut up just when there's a microphone in front of you, recording every word?"

Recording every word. Nervous was an understatement! "On Your Shoulder" is our local radio station's computer program. Every week they tell us about the effect micro chips will have on our futures and wheel on a two-year-old whizz kid.

"What's it about?" I asked.

"Micros", she said helpfully. "You're due there at seven o'clock. You can have your tea when you get back".

I arrived at the studio with five minutes to spare wearing my best suit and with my hair combed. (Andrea's doing. I think she thinks people can see through their radio sets.)

Dirk was there, all jeans, beard and dangling key ring.

"Oh you're the expert", he cried. "Eunice", he yelled to an extremely attractive secretary, "Wally's here".

"It's Bob, not Wally".

"Well, I'm sure you'd know, dear. Come and meet Jock, he's editor of Practically Computing Occasional. You boys will have a lot to talk about".

We walked into the studio and I was introduced to a rather eccentric looking individual who did everything but smoke the pipe he was clasping in the hand he shook mine with.

"Right, let's start, we've not got long, we've got a computer whizz baby coming in next and he's due for a feed".

The red light came on and the questions started.

"Wally", Dirk said, smirking at me, "Why have you squandered so much money on your micro? Isn't it a waste of time and effort?"

I was stunned and could only mumble "Er.. er, er" over and over. Andrea later recorded the thing and told me that she'd counted 15 but she'd erred on the side of sparing my feelings.

I looked at Jock for assistance and he just smiled and finally succeeded in sticking his pipe firmly in his mouth.

"Well it's a hobby", I said lamely.

"Is your marriage breaking up?"

"Not yet", I said, "but wait till I get home".

Dirk smiled grimly and turned to Jock.

"Jock, you look like a man who knows what you're talking about. Why did you buy a micro?"

"To use the word processor facility to answer my fan mail with and to keep a database of my recipes".

The pipe went back into his mouth and stayed there firmly while I struggled with questions such as: "Isn't your interest in micros just an obsessional neurosis?" and "Sales of pornographic magazines have dropped as sales of micro mags have increased. What's your explanation, then?"

I staggered out of the studio and went home, too tired to strangle Andrea.

And now I just want to forget it but can't. Andrea keeps calling me Dick Barton and I keep dreaming of Dirk asking me: "Isn't using a micro a very masculine thing?" while Jock smirks on, sucking his pipe.

The Archers will never seem the same.

Yours,

Bob