I finally figured out the computer’s defensive moves for my Awari program (Feb.82) to improve the play for better players. These additions foresee the consequences of a second move by the human, improving the original version in Basic Computer Games. The additions yield approximations only–they don’t add a point to the opponent’s score for passing home on the way to a zero pile or for a second move–but in general they’ll make the right move. The change in line 330 avoids repeating a previous move. You can eliminate lines 270-290 since the Sinclair won’t invariably move pile 1 following pile 4 and leave you to move pile 5 for 6 points. Unfortunately the initial move is always pile 4, which is a bit repetitious.
Change these lines:
330 LET H1=-99
371 LET Q=0
372 FOR T=1 TO 6
373 IF A(T)=0 THEN GOTO 381
374 LET R=0
375 LET U=A(T)+T
376 IF U>14 THEN LET U=U-14
377 IF U=7 THEN LET A(T)=0
378 IF U=7 THEN GOTO 372
379 IF A(U)=0 THEN LET R=A(14-U)+1
380 IF R>Q THEN LET Q=R
381 NEXT T
382 LET H2=A(14)-A(7)-Q
390 IF M=14 AND K=2 THEN LET H2=H2+2+Q
400 IF ABS(H1-H2)<1 THEN LET H2=H2+RND-.5
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.