# Tech Tips

**HIGHSCORE**

In the November/December 1987 issue of Pege 6, lan Finlayson published this routine that uses the forced-read mode to update high scores in computer games:

31210 TT7=0

31220 HIGHSCORE=TT7:RETURN

31230 IF HIGHSCORE<=T77 THEN RETURN

31240 GRAPHICS 0:? :? :? "31210 TT7="; HIGHSCORE

31250 ?: ?: ? "CONT"

31260 POSITION 2,0 POKE 842,13:STOP

31270 POKE 842,12:SAVE "D:GAME":RETURN

Antic pays $25 for every original and exclusiive Tech Tip submission that we publish. Send your 8-bit or ST disk and printout to: Antic Tech Tips, 544 Second Street, San Francisco, CA 94107. Tech Tips welcomes very short programs that demonstrate the Atari's powers, simple hardware modifications, or useful macros for popular software.

**A P P E N D**

Let's say you've written your own mailing list progrom and want to be able to oppend data to a file called LETTERS.DAT. Charles Jackson, Antic Technical and Online editor, suggests that beginners try the following subroutine:

10000 TRAP 11000:CLOSE #1:OPEN #1,4,0,"D:LETTERS.DAT":GOT0 11010

11000 CLOSE #1:OPEN #1,8,0,"D:LETTERS.DAT"

11010 CLOSE #1:OPEN #1,9,0,"D:LETTERS.DAT"

12000 TRAP 40000:RETURN

Line 10000 first sets a trap, then tries to open LETTERS.DAT. If no LETTERS.DAT exists on the disk, instead of generating an error, the computer goes to the line ot which the trap was set: 11000, which creates the file. If LETTERS.DAT does exist, the subroutine goes to line 11010, which OPENs the file nnd appends the data.

The TRAP 40000 in line 12000 turns off the trap.

**CORRELATIONS**

If you're a teacher, perhaps you want to find a way to express the similarity (or lack thereof) between your students' scores in two different subjectsÑ-say, science and math. Once you've ranked those scores, this little program by Gregg Pearlman, Antic Assistant Editor, can show how similar the two lists of rankings are. Just be careful where you input what.

10 Y=0:TOTAL=0:SUM=0

20 ? "NUMBER OF STUDENTS: ":INPUT STUDENTS

30 FOR X=1 TO STUDENTS

40 Y=X*X

50 TOTAL =TOTAL +Y

60 NEXT X

70 FOR PLACES=1 TO STUDENTS

80 ?"RANKING FOR #";PLACES;": ";:INPUT P1,P2

90 PRODUCT=P1 * P2

100 SUM = SUM + PRODUCT

110 NEXT PLACES

120 PCT=SUM/TOTAL

130 ? "CORRELATION: ";PCT

After you type the number of students (say, 30), lines 30 through 60 square each number from 1 to 30 and add them up (9,455) to get TOTAL.

Lines 70 and 110 prevent you from entering data for more than those 30 students. Line 80 asks you to type the rankings for the each student's science and math scores, and line 90 multiplies the two to get PRODUCT. The SUM in line 100 is simply all the values of PRODUCT added together.

Dividing SUM by TOTAL gives a percentage showing the correlation between the two lists.

If you pair numbers that add up to 31--1 and 30,2 and 29... 30 and 1Ñ-the correlation will be 52.5 %, so in theory, that would be your lowest possible result (in a list of 30). But what if you wanted to find correlations just between top-10 lists? The top 10 in science might not all be among the top 10 in math, so list all the students involved. If a student isn't on a particular list, the ranking is zero. Some of the top-10 rankings in one column will therefore be multiplied by the zero in the other, thus bringing down the final percentage.

If the second column showed the ranking in English instead of math, perhaps the percentage would be extremely lowÑ-showing an inverse correlation. It's fair to say that the further away your result is from 50 %Ñ-in either direction, the stronger the correlation (or inverse correlation).

You can use more than two lists, if you wantÑ-say, if you decided to see how strong the relationship involving science, math and music. Make these changes:

40 Y=X*X*X

80 INPUT P1,P2,P3

90 PRODUCT= P1*P2*P3