Data update

This commit is contained in:
Ingy döt Net 2025-06-11 20:16:52 -04:00
parent 72eb4943cb
commit 4d5544505c
2347 changed files with 62432 additions and 16731 deletions

View file

@ -0,0 +1,32 @@
import ballerina/io;
function r(string word, string[] bl) returns boolean {
if word == "" { return true; }
int c = word[0].toBytes()[0] | 32;
foreach int i in 0..<bl.length() {
var b = bl[i];
if c == (b.toBytes()[0] | 32) || c == (b.toBytes()[1] | 32) {
bl[i] = bl[0];
bl[0] = b;
if r(word.substring(1), bl.slice(1)) { return true; }
var t = bl[i];
bl[i] = bl[0];
bl[0] = t;
}
}
return false;
}
function newSpeller(string blocks) returns (function(string) returns boolean) {
string[] bl = re ` `.split(blocks);
return function(string word) returns boolean {
return r(word, bl);
};
}
public function main() {
var sp = newSpeller("BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM");
foreach string word in ["A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"] {
io:println(word.padEnd(7), " ", sp(word));
}
}

View file

@ -2,7 +2,7 @@ b$[][] = [ [ "B" "O" ] [ "X" "K" ] [ "D" "Q" ] [ "C" "P" ] [ "N" "A" ] [ "G" "T"
len b[] len b$[][]
global w$[] cnt .
#
proc backtr wi . .
proc backtr wi .
if wi > len w$[]
cnt += 1
return

View file

@ -41,6 +41,6 @@ public program()
words.forEach::(word)
{
console.printLine("can make '",word,"' : ",word.canMakeWordFrom(blocks));
Console.printLine("can make '",word,"' : ",word.canMakeWordFrom(blocks));
}
}