10DEFFNS="SCRABLE"
12REM Line 10 is neat! To save the pr
ogram, type in SAVE FNS and it saves it
to disc with the name given in quotes. T
hanks to Jon (Ed).
13
14REM A small program to choose 7 ran
dom letters for 4 players at scrabble.
15
19
20MODE7
21REM I find that putting in the mode
like this is a neat way of getting the p
rogram to clear a lot of things in the c
omputer. Don't know why!
22
23REM I guess MODE 7 is kind of basic
!
24REM "SCRABBLE"
25
26REM The scrabble bag has 100 letter
s in it. There are 26 letters in the alp
habet and a blank (#) makes 27. Each let
ter in the alphabet has its own score so
27 scores as well.
27
28REM See lines 600-610 for letters a
nd scores.
29
30REM Line 40 sets aside space for th
e letters,numbers of letters and scores
31
32REM Does DIM mean the computer is s
o dim that it has to be TOLD to set the
space aside?!
33
34REM Or is it that they have been ki
nd and given us dim humans a basic code
word to do it?!!
39
40DIMletter$(100),number(27),score(27
)
41
43
44REM Now we can make 3 numbered list
s in this space.
45
46REM To do this we can use a variabl
e 1 to 100 and 1 to 27.FOR X=- TO - seem
s the best way
49
50FORX=1TO100:READletter$(X):NEXT
52FORX=1TO27:READnumber(X),score(X):N
EXT
53
54REM Lines 60 to 100 use a procedure
4 times to choose 7 letters for each pl
ayer
55
56REPEAT
59
60FORP=1TO4
70PROCchoose7
100NEXT
110PRINTTAB(2,18)"Press any key to go
again. Escape to exit. LIST CTRLN RET
URN to list program and read it."
120IF GET
130UNTIL FALSE
199
200DEFPROCchoose7
210FORX=1TO7
220R=RND(100)
230N=FNn(ASCletter$(R))
234IFnumber(N)=0GOTO220
240PRINTTAB(X*3,P*4)letter$(R)
250number(N)=number(N)-1
260NEXT
290ENDPROC
299
330REMthe procedure above uses a loop
of 7 to get 7 letters for the player lin
es 210 - 260
331
332REM puts a random number between 1
and 100 into R line 220
333
334 REMturns it into a number from 1 t
o 27 at line 230 see FNn()
335
336REMchecks to see if this letter is
in the bag line 234
337
338REM if not sends you back to random
R again to get another one
339
340REMprints the letter on screen
341
342REMtakes one away from number(N) in
the list holding the numbers of each le
tter. E.G. There are 9 A,s. number(1)=9.
9-1=8. Now number(1) will be 8. and so o
n.
599
600DATAA,A,A,A,A,A,A,A,A,B,B,C,C,D,D,D
,D,E,E,E,E,E,E,E,E,E,E,E,E,F,F,G,G,G,H,H
,I,I,I,I,I,I,I,I,I,J,K,L,L,L,L,M,M,N,N,N
,N,N,N,O,O,O,O,O,O,O,O,P,P,Q,R,R,R,R,R,R
,S,S,S,S,T,T,T,T,T,T,U,U,U,U,V,V,W,W,X,Y
,Y,Z,#,#
610DATA9,1,2,3,2,3,4,2,12,1,2,4,3,2,2,
4,9,1,1,8,1,5,4,1,2,3,6,1,8,1,2,3,1,10,6
,1,4,1,6,1,4,1,2,4,2,4,1,8,2,4,1,10,2,0
619
620REM if you look at the DATA you can
see the 100 letters in line 600
621
622REM line 610 has the number of (A's
) and its score value, then the number o
f B's and its score value etc etc to Z a
nd the # which come last.
699
700DEFFNn(N):IFN>64N=N-64
710IFN=35N=27
720=N
749
750REM N=ASCletter$(R) this means that
it converts the letter taken out of the
bag into its ASC value A=65, B=66 etc.
and puts this number into N.
751
752REMthe FNn then first takes away 64
so that we have the numbers 1 to 26 for
the letters of the alphabet
753
754REMthen second, looks to see if th
e blank (#) has been chosen (ASC 35) if
so changes it into 27 to fit in the numb
ered list.