29 lines
930 B
Plaintext
29 lines
930 B
Plaintext
List words ← text["", "A", "Bark", "book", "TREAT", "COMMON", "SQuAd", "CONFUSE"]
|
|
List checks ← logic[true, true, true, false, true, false, true, true]
|
|
fun canMakeWord ← logic by text word
|
|
if word.length æ 0 do return true end
|
|
List wblocks ← text[
|
|
"BO", "XK", "DQ", "CP", "NA",
|
|
"GT", "RE", "TG", "QD", "FS",
|
|
"JW", "HU", "VI", "AN", "OB",
|
|
"ER", "FS", "LY", "PC", "ZM"]
|
|
for each text ch in word.upper().split()
|
|
logic found ← false
|
|
for each text wblock in wblocks
|
|
if wblock.find(ch) ≥ 0
|
|
wblocks[wblockIndex] ← Text.EMPTY
|
|
found ← true
|
|
break
|
|
end
|
|
end
|
|
if not found do return false end
|
|
end
|
|
return true
|
|
end
|
|
writeLine("word".padEnd(11, " "), "|", "canMakeWord", "|", "isCorrect")
|
|
for each text word in words
|
|
writeLine(word.padEnd(11, " "), "|",
|
|
(text!canMakeWord(word)).padEnd(11, " "), "|",
|
|
(canMakeWord(word) æ checks[wordIndex]))
|
|
end
|