In a Scrabble® set there are 100 tiles, consisting of: E (12); A, I, (9); O, (8); N, R, T (6); D, L S, U (4); G (3); B, C, F, H, M, P, V, W, Y (2); J, K, Q, X, Z (1); and 2 blanks that can be used as wild cards to represent any letter.
A player is selecting tiles prior to making the first move.
If the first six tiles drawn are A, E, N, R, S, and T, what is the probability that the seventh tile will complete a 7 letter word?
From my word list I get 75 tiles that will fill the bill. Out of the 94 tiles left in the set, that makes a probability of almost 80%:
75 / 94 = .7978724
The possible drawn extra letters, how many words can be formed with that letter, the number of tiles remaining with that letter and the found words are:
b 1 2 banters
c 7 2 canters carnets nectars recants scanter tanrecs trances
d 1 4 stander
e 3 11 earnest eastern nearest
g 3 3 argents garnets strange
h 2 2 anthers thenars
i 9 9 anestri antsier nastier ratines retains retinas retsina stainer stearin
k 2 1 rankest tankers
l 4 4 antlers rentals saltern sternal
m 3 2 martens sarment smarten
n 1 5 tanners
o 3 8 atoners senator treason
p 5 2 arpents entraps parents pastern trepans
r 2 5 errants ranters
t 2 5 natters rattens
u 2 4 natures saunter
v 3 2 servant taverns versant
w 1 2 wanters
The program is:
DATA 9,2,2,4,12,2,3,2,9,1,1,4,2,6,8,2,1,6,4,6,4,2,2,1,2,1
' a b c d e f g h i j k l m n o p q r s t u v w x y z
DIM freq(26)
FOR i = 1 TO 26
READ freq(i)
totLet = totLet + freq(i)
NEXT
s1$ = "aenrst"
FOR i = 1 TO LEN(s1$)
sb = ASC(MID$(s1$, i, 1)) - ASC("a") + 1
freq(sb) = freq(sb) - 1
NEXT
totLet = totLet - LEN(s1$)
w$ = SPACE$(7)
DIM letused(26)
OPEN "\words\words7.txt" FOR BINARY AS #1
DO
GET #1, , w$
IF EOF(1) THEN EXIT DO
s2$ = s1$: extra$ = "": good = 1
FOR i = 1 TO LEN(w$)
ix = INSTR(s2$, MID$(w$, i, 1))
IF ix = 0 THEN
IF extra$ > "" THEN good = 0: EXIT FOR
extra$ = MID$(w$, i, 1)
ELSE
s2$ = LEFT$(s2$, ix - 1) + MID$(s2$, ix + 1)
END IF
NEXT
IF good THEN
sb = ASC(extra$) - ASC("a") + 1
IF sb > 0 AND sb <= 26 THEN
letused(sb) = letused(sb) + 1
END IF
END IF
LOOP
CLOSE
FOR i = 1 TO 26
IF letused(i) > 0 THEN
ways = ways + freq(i)
END IF
NEXT
PRINT ways + 2; "/"; totLet + 2; "="; (ways + 2) / (totLet + 2)
FOR j = 1 TO 26
IF letused(j) > 0 THEN
OPEN "\words\words7.txt" FOR BINARY AS #1
PRINT CHR$(ASC("a") - 1 + j); " "; letused(j); freq(j);
s3$ = s1$ + CHR$(ASC("a") - 1 + j)
DO
GET #1, , w$
IF EOF(1) THEN EXIT DO
s2$ = s3$: extra$ = "": good = 1
FOR i = 1 TO LEN(w$)
ix = INSTR(s2$, MID$(w$, i, 1))
IF ix = 0 THEN
good = 0: EXIT FOR
ELSE
s2$ = LEFT$(s2$, ix - 1) + MID$(s2$, ix + 1)
END IF
NEXT
IF good THEN
PRINT w$; " ";
END IF
LOOP
PRINT
CLOSE
END IF
NEXT
CLOSE
|
Posted by Charlie
on 2006-02-03 11:36:00 |