30 lines
908 B
Plaintext
30 lines
908 B
Plaintext
string 0;
|
|
|
|
char Side1, Side2;
|
|
def Size = 20;
|
|
char Avail(Size);
|
|
|
|
func CanMakeWord(Word); \returns 'true' if blocks can make Word
|
|
char Word;
|
|
int I, Let;
|
|
[Let:= Word(0) & $5F; \get letter and make sure it's uppercase
|
|
if Let = 0 then return true; \if 0 then end of word; return successful
|
|
for I:= 0 to Size-1 do \scan for block that contains letter
|
|
if Avail(I) and (Side1(I) = Let or Side2(I) = Let) then
|
|
[Avail(I):= false;
|
|
if CanMakeWord(Word+1) then return true;
|
|
];
|
|
return false;
|
|
];
|
|
|
|
int I, J, Words;
|
|
[Side1:= "BXDCNGRTQFJHVAOEFLPZ";
|
|
Side2:= "OKQPATEGDSWUINBRSYCM";
|
|
Words:= ["A", "bark", "Book", "Treat", "Common", "Squad", "conFuse"];
|
|
for J:= 0 to 6 do
|
|
[Text(0, "Can make ^""); Text(0, Words(J)); Text(0, "^": ");
|
|
for I:= 0 to Size-1 do Avail(I):= true;
|
|
Text(0, if CanMakeWord(Words(J)) then "True" else "False"); CrLf(0);
|
|
];
|
|
]
|