38 lines
895 B
Plaintext
38 lines
895 B
Plaintext
get "libhdr"
|
|
|
|
let canMakeWord(word) = valof
|
|
$( let blocks = "BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM"
|
|
let avl = vec 40/BYTESPERWORD
|
|
for i=0 to 39 do avl%i := blocks%(i+1)
|
|
for i=1 to word%0
|
|
$( for j=0 to 39
|
|
$( let ch = word%i
|
|
// make letter uppercase
|
|
if 'a' <= ch <= 'z' then ch := ch - 32
|
|
if ch = avl%j then
|
|
$( // this block is no longer available
|
|
avl%j := 0
|
|
avl%(j neqv 1) := 0
|
|
// but we did find a block
|
|
goto next
|
|
$)
|
|
$)
|
|
resultis false // no block found
|
|
next: loop
|
|
$)
|
|
resultis true
|
|
$)
|
|
|
|
let show(word) be
|
|
writef("%S: %S*N", word, canMakeWord(word) -> "yes", "no")
|
|
|
|
let start() be
|
|
$( show("A")
|
|
show("BARK")
|
|
show("book")
|
|
show("Treat")
|
|
show("CoMmOn")
|
|
show("SQUAD")
|
|
show("CONFUSE")
|
|
$)
|