introduce bitloops

This commit is contained in:
mike
2026-01-20 19:06:59 +01:00
parent dadde53f76
commit ddce9addb5
28 changed files with 87335 additions and 87363 deletions

View File

@@ -14,6 +14,6 @@ public final class DictData {
idx[6] = DictDataL6.entry(); idx[6] = DictDataL6.entry();
idx[7] = DictDataL7.entry(); idx[7] = DictDataL7.entry();
idx[8] = DictDataL8.entry(); idx[8] = DictDataL8.entry();
return new puzzle.SwedishGenerator.Dict(idx, 38674); return new puzzle.SwedishGenerator.Dict(idx, 38691);
} }
} }

View File

@@ -6,7 +6,7 @@ public final class DictDataL5 {
static final int LEN = 5; static final int LEN = 5;
static final int ROWS = 130; static final int ROWS = 130;
static final int COLS = 69; static final int COLS = 69;
static final int WORDS_LEN = 4402; static final int WORDS_LEN = 4403;
static final int POS_LEN = 8970; static final int POS_LEN = 8970;
private static long[] words() { private static long[] words() {

File diff suppressed because it is too large Load Diff

View File

@@ -14,14 +14,14 @@ public final class DictDataL5P1 {
0x20012040001L, 0x20012040001L,
0x11010L, 0x11010L,
0x0L, 0x0L,
0x19000200200L, 0x32000400400L,
0x2000000800000L, 0x4000001000000L,
0x440000L, 0x880000L,
0x0L, 0x0L,
0x810000000L, 0x1020000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x1000000000L, 0x2000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -83,15 +83,15 @@ public final class DictDataL5P1 {
0x200004400000000L, 0x200004400000000L,
0x2000008000L, 0x2000008000L,
0x0L, 0x0L,
0x20000L,
0x40000L, 0x40000L,
0x10L, 0x80000L,
0x4080000000000000L, 0x20L,
0xa0000000000000L, 0x8100000000000000L,
0x6001000040800000L, 0x140000000000000L,
0x8080L, 0xc002000081000000L,
0x80000040L, 0x10100L,
0x100000400L, 0x100000080L,
0x200000800L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -222,14 +222,14 @@ public final class DictDataL5P1 {
0x0L, 0x0L,
0x4200000L, 0x4200000L,
0x0L, 0x0L,
0x80000L, 0x100000L,
0x0L, 0x0L,
0x100000000000L, 0x200000000000L,
0x40000000000L, 0x80000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x400000L, 0x800000L,
0x10300001010L, 0x10300001010L,
0x21000000L, 0x21000000L,
0x1002002000000000L, 0x1002002000000000L,
@@ -289,16 +289,16 @@ public final class DictDataL5P1 {
0x800084c0084084L, 0x800084c0084084L,
0x8880000a90012L, 0x8880000a90012L,
0x1000480008380040L, 0x1000480008380040L,
0x200604400401245L, 0x400c08800401245L,
0x4002040000c01008L, 0x8004080001802010L,
0x84455a2400400300L, 0x88ab44800800600L,
0x4112882950201406L, 0x82251052a040280dL,
0x941241042d00e01L, 0x1282482085a01c02L,
0x720700200180022cL, 0xe40e004003000458L,
0x8c19d2a000288L, 0x11833a54000510L,
0x442d48284c040226L, 0x885a90509808044cL,
0x384bf1400092c224L, 0x7097e28001258448L,
0x2000000158008L, 0x40000002b0010L,
0x27024022002L, 0x27024022002L,
0xa140000360000L, 0xa140000360000L,
0x180104602400246L, 0x180104602400246L,
@@ -358,16 +358,16 @@ public final class DictDataL5P1 {
0x4a01e04105008000L, 0x4a01e04105008000L,
0x44248808001040L, 0x44248808001040L,
0x2240a54232004000L, 0x2240a54232004000L,
0xfdc40d8048040000L, 0xfb881b0088040000L,
0xa0a828380028b4L, 0x141505070005169L,
0x1108a009c9034c51L, 0x22114013920698a2L,
0x808473d22309cb48L, 0x108e7a446139690L,
0x3206ca0fbd0a319cL, 0x640d941f7a146339L,
0x8d18c2c4225e65d1L, 0x1a31858844bccba2L,
0x91d62a62845ecc52L, 0x23ac54c508bd98a5L,
0x98d0145030f35451L, 0x31a028a061e6a8a3L,
0x214060f552d0803L, 0x4280c1eaa5a1007L,
0x212a22a1044L, 0x42544542088L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -428,11 +428,11 @@ public final class DictDataL5P1 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x800000000000000L, 0x1000000000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x10000000000L, 0x20000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -567,13 +567,13 @@ public final class DictDataL5P1 {
0x100000000000000L, 0x100000000000000L,
0x1000000L, 0x1000000L,
0x0L, 0x0L,
0x4000000L, 0x8000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x800L, 0x1000L,
0x80L, 0x100L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -637,13 +637,13 @@ public final class DictDataL5P1 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x1800000000000000L, 0x3000000000000000L,
0x40000L, 0x80000L,
0x2L, 0x4L,
0x400100000000004L, 0x800200000000008L,
0x2000000080000L, 0x4000000100000L,
0x1000L, 0x2000L,
0x408000004000L, 0x810000008000L,
0x8000000000L, 0x8000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -708,11 +708,11 @@ public final class DictDataL5P1 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x200000010000L, 0x400000020000L,
0x0L, 0x0L,
0x2000000000000000L, 0x4000000000000000L,
0x0L, 0x0L,
0x1a16848800000L, 0x342d091000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -777,7 +777,7 @@ public final class DictDataL5P1 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x100000000L, 0x200000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@ public final class DictDataL6 {
static final int LEN = 6; static final int LEN = 6;
static final int ROWS = 156; static final int ROWS = 156;
static final int COLS = 111; static final int COLS = 111;
static final int WORDS_LEN = 7065; static final int WORDS_LEN = 7068;
static final int POS_LEN = 17316; static final int POS_LEN = 17316;
private static long[] words() { private static long[] words() {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -4,49 +4,49 @@ public final class DictDataL6P2 {
private DictDataL6P2() {} private DictDataL6P2() {}
public static long[] get() { public static long[] get() {
return new long[] { return new long[] {
0x201000800001L, 0x402001000002L,
0x4420001008100031L, 0x8840002010200062L,
0x1801000040020010L, 0x3002000080040020L,
0x1060000000848000L, 0x20c0000001090000L,
0x808801800040008L, 0x1011003000080010L,
0x1704000002400088L, 0x2e08000004800110L,
0x2080090005404L, 0x410012000a808L,
0x88200000010200L, 0x110400000020400L,
0x20800840000008L, 0x41001080000010L,
0x421a0440880c0000L, 0x8434088110180000L,
0x5805010958400140L, 0x6014042530800280L,
0x248000000002009L, 0x920000000008025L,
0x400800000000500L, 0x1002000000001400L,
0x808081200400400L, 0x2020204801001000L,
0x300080049000804L, 0xc00200124002010L,
0x20110a00000002L, 0x80442800000008L,
0x204402002000a000L, 0x8110080080028000L,
0x8000010400000000L, 0x41000000000L,
0x90420c000080104L, 0x2410830000200412L,
0x2c00000004001410L, 0xb000000010005040L,
0x1101200000a40040L, 0x4404800002900100L,
0x1000000L, 0x4000000L,
0x805000000001L, 0x2014000000004L,
0x82401040001400L, 0x209004100005000L,
0x4240a0000L, 0x1090280000L,
0x4000002L, 0x810000008L,
0x1200024070000000L, 0x9000120380000000L,
0x850000200022L, 0x4280001000110L,
0x200122000000c010L, 0x9100000060080L,
0x20c002080200100L, 0x1060010401000801L,
0x10001202000000L, 0x80009010000000L,
0x400260000088410L, 0x2001300000442080L,
0x1002021300L, 0x8010109800L,
0x50010001100000L, 0x280080008800000L,
0x1002000000028000L, 0x8010000000140000L,
0x400000000000001L, 0x2000000000000008L,
0x110000000L, 0x880000000L,
0x1202000000400400L, 0x9010000002002000L,
0x4000000008800000L, 0x44000000L,
0x20000000L, 0x100000002L,
0x20000L, 0x100000L,
0x1000L, 0x8000L,
0x1000000004000000L, 0x8000000020000000L,
0x0L, 0x0L,
0x1000000010000L, 0x1000000010000L,
0x2480210010000008L, 0x2480210010000008L,
@@ -92,73 +92,73 @@ public final class DictDataL6P2 {
0x24000040000L, 0x24000040000L,
0x910000200L, 0x910000200L,
0x1020000000000L, 0x1020000000000L,
0x200008000L, 0x400008000L,
0x1000000005001000L, 0x200000000a002000L,
0x2183104008004010L, 0x4306208010008020L,
0x201000000800280L, 0x402000001000500L,
0x12000000000020L, 0x24000000000040L,
0x8011L, 0x10022L,
0x9000001410000020L, 0x2000002820000040L,
0x108000880002000L, 0x210001100004001L,
0x4003000000L, 0x8006000000L,
0x80820031a9000010L, 0x104006352000020L,
0x50000c8800000804L, 0xa000191000001009L,
0x2000400450L, 0x40008008a0L,
0x4941000740800000L, 0x9282000e81000000L,
0x520000000000100L, 0xa40000000000200L,
0x68000000040L, 0xd0000000080L,
0x200040080300L, 0x400080100600L,
0x2200c04002a2413L, 0x440180800544826L,
0x4000000004a04L, 0x8000000009408L,
0x8424010080080208L, 0x848020100100410L,
0x200b00800042800L, 0x401601000085001L,
0x8008000000000L, 0x10010000000000L,
0x8008005200404bL, 0x1001000a4008096L,
0xc820a00001800410L, 0x9041400003000820L,
0x400000412183800L, 0x800000824307001L,
0x6426800001080L, 0xc84d000002100L,
0x404000200000001L, 0x808000400000002L,
0x4401404058024001L, 0x88028080b0048002L,
0x180400048000422L, 0x300800090000844L,
0x4090090808080000L, 0x8120121010100000L,
0x1a70200100122100L, 0x34e0400200244200L,
0x8002024010000800L, 0x4048020001000L,
0x1402400080900000L, 0x2804800101200001L,
0x8000000200410002L, 0x400820004L,
0x303092040080a7L, 0xc0c2480801014fL,
0x1021008200000320L, 0x4084020800000c80L,
0x48080294a0802800L, 0x20200a528200a000L,
0xc08040004018006dL, 0x2010001006001b5L,
0x240a810802012002L, 0x902a04200804800bL,
0x400604000080a0L, 0x100181000020280L,
0x101040484110000L, 0x404101210440000L,
0x220000214120ca0L, 0x880000850483280L,
0x43820000100042L, 0x10e080000400108L,
0xc210400080040024L, 0x841000200100090L,
0x48000000002L, 0x12000000000bL,
0x1008e01008003c1L, 0x402380402000f04L,
0x508c44000680L, 0x1423110001a00L,
0x2000970028008000L, 0x80025c00a0020000L,
0x84488890c2002002L, 0x1122224308008008L,
0x13c000000000c0L, 0x9e000000000302L,
0x40610000002000a4L, 0x308000001000520L,
0x12200044008000L, 0x91000220040002L,
0x12c08c4c00090808L, 0x9604626000484040L,
0x8001001a0008061aL, 0x800d0004030d0L,
0x20038089c008001L, 0x1001c044e004000cL,
0x804040001820L, 0x402020000c100L,
0x90012540010080L, 0x480092a00080400L,
0x30010808802013a0L, 0x8008404401009d00L,
0x4800002001050L, 0x24000010008281L,
0x10008101a004000L, 0x8004080d0020000L,
0x2183c0044802329L, 0x10c1e00224011948L,
0x400986480005a02L, 0x2004c3240002d010L,
0x10000000041c06L, 0x8000000020e030L,
0x60209a04c03aa0L, 0x30104d02601d500L,
0x408601040600L, 0x2043008203000L,
0x1420080001a100L, 0xa10040000d0800L,
0x100204002L, 0x801020010L,
0x1001L, 0x8008L,
0x0L, 0x0L,
0x40000000000L, 0x40000000000L,
0x108000000140202L, 0x108000000140202L,
@@ -203,73 +203,73 @@ public final class DictDataL6P2 {
0x800000000400004L, 0x800000000400004L,
0x1000000001012000L, 0x1000000001012000L,
0x1000000000102000L, 0x1000000000102000L,
0x120b00080L, 0x240b00080L,
0x8000020000100L, 0x10000040000200L,
0x8000000000000000L, 0x0L,
0x40100c0050000800L, 0x80201800a0001001L,
0x18000000000L, 0x30000000000L,
0x1000000000820024L, 0x2000000001040048L,
0x2200100000200240L, 0x4400200000400480L,
0x93020400001000L, 0x126040800002000L,
0x9104404002L, 0x12208808004L,
0x44200900000L, 0x88401200000L,
0x2400000040010L, 0x4800000080020L,
0x844000120000L, 0x1088000240000L,
0x8080080300001L, 0x10100100600002L,
0x1001000000014L, 0x2002000000028L,
0x400008c02L, 0x800011804L,
0x101000e812010010L, 0x202001d024020020L,
0x400204002100000L, 0x800408004200000L,
0x4800040200000400L, 0x9000080400000800L,
0x400L, 0x800L,
0x140L, 0x280L,
0x2320015408840031L, 0x464002a811080062L,
0x8000045c00000010L, 0x8b800000020L,
0x500004002008000L, 0xa00008004010001L,
0x10c62040220204L, 0x218c4080440408L,
0x800018200004000L, 0x1000030400008000L,
0x6110103c00080868L, 0xc2202078001010d0L,
0xa00280800080004L, 0x1400501000100008L,
0x200260484020004L, 0x4004c0908040008L,
0x800341250000000L, 0x10006824a0000000L,
0x8040a400000000L, 0x100814800000000L,
0x808886041040L, 0x101110c082080L,
0x9000208010800L, 0x12000410021000L,
0x40000001001000L, 0x80000002002000L,
0x82002080193008L, 0x208008200326010L,
0x104281c81430800L, 0x410a072050c2000L,
0x10220821541800e1L, 0x4088208550600384L,
0x2000900006082L, 0x8002400018208L,
0x9860064010061241L, 0x6180190040184904L,
0x5010c010176b4c10L, 0x404300405dad3042L,
0x8200021100c00c0L, 0x2080008440300301L,
0x8d080102ba9e000L, 0x23420040aea78000L,
0x7000041247800880L, 0xc00010491e002200L,
0x100020bc5ba06881L, 0x400082f16e81a205L,
0x2bc030001088a08L, 0xaf00c0004222820L,
0x5220000200659800L, 0x4880000801966000L,
0xf9c0010080186108L, 0xe700040200618421L,
0x900020c001000196L, 0x400083000400065bL,
0x2a20030000044e0cL, 0xa8800c0000113832L,
0x4b04127818da2c29L, 0x582093c06368b0a4L,
0x8040000044411L, 0x4020000022208aL,
0x10000850801b0e40L, 0x8000428400d87200L,
0x500010121800001L, 0x280008090c000008L,
0x810a80000109080L, 0x4085400000848400L,
0x206300014028038cL, 0x318000a01401c60L,
0x88041101d340100L, 0x44020880e9a00801L,
0x4cc000090004bL, 0x26600004800258L,
0x200700200414002L, 0x10038010020a0010L,
0x50020800044000cL, 0x2801040002200060L,
0x401c004120831a22L, 0xe002090418d110L,
0xc8468200000b0800L, 0x4234100000584002L,
0x20009034000090L, 0x1000481a0000486L,
0x340084020202100L, 0x1a00420101010800L,
0x11940c0090200400L, 0x8ca0600481002000L,
0x8808100c4902000L, 0x4404080624810000L,
0x1008012204007L, 0x8040091020038L,
0x204842a4a082001L, 0x1024215250410008L,
0x4a0L, 0x2500L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -316,7 +316,7 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x800000L, 0x1000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -350,27 +350,27 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x1000L, 0x4000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x2000000000000000L, 0x8000000000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x100000L, 0x400000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x400000000000L, 0x2000000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x8000000L, 0x40000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -378,7 +378,7 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x200000000L, 0x1000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -540,7 +540,7 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x20000000000000L, 0x40000000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -558,15 +558,15 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x40000L, 0x80000L,
0x0L, 0x0L,
0x100L, 0x200L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x10L, 0x20L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -579,7 +579,7 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x200000000L, 0x800000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -587,22 +587,22 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x420000L, 0x2100000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x8000000000000000L,
0x0L,
0x0L,
0x400L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x8000000000L, 0x4L,
0x40L, 0x0L,
0x2000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x40000000000L,
0x200L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -701,19 +701,19 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x20000000L, 0x100000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x8000000000L, 0x40000000000L,
0x400000000000000L, 0x2000000000000000L,
0x0L, 0x0L,
0x40011000000000L, 0x200088000000000L,
0x40000000400100L, 0x200000002000800L,
0x502a02L, 0x2815010L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -787,7 +787,7 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x1L, 0x2L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -795,7 +795,7 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x80000L, 0x200000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -805,27 +805,26 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x2000000000L, 0x8000000000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x2000000L, 0x10000000L,
0x0L, 0x0L,
0x20000L, 0x100000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x40004000000000L, 0x200020000000000L,
0x80004L, 0x400020L,
0x8000000000000000L,
0x0L, 0x0L,
0x4L,
0x0L, 0x0L,
0x4000000000004L, 0x20000000000020L,
0x0L, 0x0L,
0x4000000000000000L,
0x8000000000020L,
0x200000004020000L,
0x400100400800200L,
0x220000L,
0x0L, 0x0L,
0x40000000000102L,
0x1000000020100000L,
0x2000802004001000L,
0x1100000L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
@@ -931,7 +930,8 @@ public final class DictDataL6P2 {
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,
0x10L, 0x0L,
0x80L,
0x0L, 0x0L,
0x0L, 0x0L,
0x0L, 0x0L,

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@ public final class DictDataL7 {
static final int LEN = 7; static final int LEN = 7;
static final int ROWS = 182; static final int ROWS = 182;
static final int COLS = 174; static final int COLS = 174;
static final int WORDS_LEN = 11117; static final int WORDS_LEN = 11121;
static final int POS_LEN = 31668; static final int POS_LEN = 31668;
private static long[] words() { private static long[] words() {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@ public final class DictDataL8 {
static final int LEN = 8; static final int LEN = 8;
static final int ROWS = 208; static final int ROWS = 208;
static final int COLS = 202; static final int COLS = 202;
static final int WORDS_LEN = 12877; static final int WORDS_LEN = 12886;
static final int POS_LEN = 42016; static final int POS_LEN = 42016;
private static long[] words() { private static long[] words() {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -15,19 +15,19 @@ public final class DictJavaGeneratorMulti {
// Smaller = more files, but safer for javac/class limits. // Smaller = more files, but safer for javac/class limits.
private static final int WORDS_CHUNK = 8_192; private static final int WORDS_CHUNK = 8_192;
private static final int POS_CHUNK = 8_192; private static final int POS_CHUNK = 8_192;
public static final int THRESS = 800;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
Path wordsFile = Path.of(args.length > 0 ? args[0] : "nl_score_hints_v4.csv"); var THRESS = 900;
Path outDir = Path.of(args.length > 1 ? args[1] : "src/main/generated-sources/puzzle/dict" + THRESS); var wordsFile = Path.of(args.length > 0 ? args[0] : "nl_score_hints_v4.csv");
String pkg = "puzzle.dict" + THRESS; var outDir = Path.of(args.length > 1 ? args[1] : "src/main/generated-sources/puzzle/dict" + THRESS);
HashMap<String, ShardBuilder> builders = new HashMap<String, ShardBuilder>(16); var pkg = "puzzle.dict" + THRESS;
var builders = new HashMap<String, ShardBuilder>(16);
SwedishGenerator.Dict dict = buildDict(wordsFile, builders, THRESS); var dict = buildDict(wordsFile, builders, THRESS);
Files.createDirectories(outDir); Files.createDirectories(outDir);
// Generate L2..L8 // Generate L2..L8
for (int L = 2; L <= 8; L++) { for (var L = 2; L <= 8; L++) {
var entry = dict.index()[L]; var entry = dict.index()[L];
if (entry == null || entry.words() == null || entry.words().length == 0) { if (entry == null || entry.words() == null || entry.words().length == 0) {
throw new IllegalStateException("No words for length " + L); throw new IllegalStateException("No words for length " + L);
@@ -36,7 +36,7 @@ public final class DictJavaGeneratorMulti {
} }
// Aggregator // Aggregator
writeAggregator(outDir, pkg, "DictData", dict.length()); writeAggregator(outDir, pkg, "DictData", dict.length(), THRESS);
System.out.println("Generated sources into: " + outDir.toAbsolutePath()); System.out.println("Generated sources into: " + outDir.toAbsolutePath());
} }
@@ -48,21 +48,21 @@ public final class DictJavaGeneratorMulti {
var map = new LongArrayList(100_000); var map = new LongArrayList(100_000);
try (var lines = Files.lines(wordsPath, StandardCharsets.UTF_8)) { try (var lines = Files.lines(wordsPath, StandardCharsets.UTF_8)) {
lines.forEach(line -> { lines.forEach(line -> {
var parts = line.split(",", 4); var parts = line.split(",", 4);
var word = parts[0].trim(); var word = parts[0].trim();
long w = SwedishGenerator.Lemma.from(word.getBytes(US_ASCII)); var w = SwedishGenerator.Lemma.from(word.getBytes(US_ASCII));
if (!word.equals(SwedishGenerator.Lemma.asWord(w, Export.BYTES.get()))) { if (!word.equals(SwedishGenerator.Lemma.asWord(w, Export.BYTES.get()))) {
throw new RuntimeException(); throw new RuntimeException();
} }
int score = Integer.parseInt(parts[1].trim()); var score = Integer.parseInt(parts[1].trim());
var simpel = Integer.parseInt(parts[CsvIndexService.SIMPEL_IDX].trim()); var simpel = Integer.parseInt(parts[CsvIndexService.SIMPEL_IDX].trim());
if (score < 1 || simpel > thress) { if (score < 1 || simpel > thress) {
if (Main.VERBOSE) System.err.println("Word too complex: " + line); if (Main.VERBOSE) System.err.println("Word too complex: " + line);
return; return;
} }
var key = shardKey(w); var key = shardKey(w);
ShardBuilder sb = builders.computeIfAbsent(key, k -> new ShardBuilder()); var sb = builders.computeIfAbsent(key, k -> new ShardBuilder());
map.add(Lemma.pack(w, sb.addRecord())); map.add(Lemma.pack(w, sb.addRecord()));
}); });
} }
@@ -80,23 +80,23 @@ public final class DictJavaGeneratorMulti {
val idx = entry.words().size(); val idx = entry.words().size();
val pos = entry.pos(); val pos = entry.pos();
entry.words().add(lemma); entry.words().add(lemma);
int i = 0; var i = 0;
for (long w = lemma & Lemma.LETTER_MASK; w != 0; w >>>= 5, i++) { for (var w = lemma & Lemma.LETTER_MASK; w != 0; w >>>= 5, i++) {
pos[i][(int) ((w & 31) - 1)].add(idx); pos[i][(int) ((w & 31) - 1)].add(idx);
} }
} }
for (int i = 2; i < index.length; i++) if (index[i].words().size() <= 0) throw new RuntimeException("No words for length " + i); for (var i = 2; i < index.length; i++) if (index[i].words().size() <= 0) throw new RuntimeException("No words for length " + i);
return new Dict(Arrays.stream(index).map(i -> { return new Dict(Arrays.stream(index).map(i -> {
var words = i.words().toArray(); var words = i.words().toArray();
int numWords = words.length; var numWords = words.length;
int numLongs = (numWords + 63) >>> 6; var numLongs = (numWords + 63) >>> 6;
var bitsets = new long[i.pos().length * 26][numLongs]; var bitsets = new long[i.pos().length * 26][numLongs];
for (int p = 0; p < i.pos().length; p++) { for (var p = 0; p < i.pos().length; p++) {
for (int l = 0; l < 26; l++) { for (var l = 0; l < 26; l++) {
var list = i.pos()[p][l]; var list = i.pos()[p][l];
var bs = bitsets[p * 26 + l]; var bs = bitsets[p * 26 + l];
for (int k = 0; k < list.size(); k++) { for (var k = 0; k < list.size(); k++) {
int wordIdx = list.data()[k]; var wordIdx = list.data()[k];
bs[wordIdx >>> 6] |= (1L << (wordIdx & 63)); bs[wordIdx >>> 6] |= (1L << (wordIdx & 63));
} }
} }
@@ -117,18 +117,16 @@ public final class DictJavaGeneratorMulti {
} }
} }
static final int VERSION = 1; private static void writeAggregator(Path outDir, String pkg, String cls, int totalLen, int thress) throws IOException {
var out = outDir.resolve(cls + ".java");
private static void writeAggregator(Path outDir, String pkg, String cls, int totalLen) throws IOException { try (var w = writer(out)) {
Path out = outDir.resolve(cls + ".java");
try (BufferedWriter w = writer(out)) {
w.write("package " + pkg + ";\n\n"); w.write("package " + pkg + ";\n\n");
w.write("public final class " + cls + " {\n"); w.write("public final class " + cls + " {\n");
w.write(" private " + cls + "() {}\n\n"); w.write(" private " + cls + "() {}\n\n");
w.write(" public static final puzzle.SwedishGenerator.Dict DICT" + THRESS + " = build();\n\n"); w.write(" public static final puzzle.SwedishGenerator.Dict DICT" + thress + " = build();\n\n");
w.write(" private static puzzle.SwedishGenerator.Dict build() {\n"); w.write(" private static puzzle.SwedishGenerator.Dict build() {\n");
w.write(" puzzle.SwedishGenerator.DictEntry[] idx = new puzzle.SwedishGenerator.DictEntry[puzzle.SwedishGenerator.MAX_WORD_LENGTH_PLUS_ONE];\n"); w.write(" puzzle.SwedishGenerator.DictEntry[] idx = new puzzle.SwedishGenerator.DictEntry[puzzle.SwedishGenerator.MAX_WORD_LENGTH_PLUS_ONE];\n");
for (int L = 2; L <= 8; L++) w.write(" idx[" + L + "] = DictDataL" + L + ".entry();\n"); for (var L = 2; L <= 8; L++) w.write(" idx[" + L + "] = DictDataL" + L + ".entry();\n");
w.write(" return new puzzle.SwedishGenerator.Dict(idx, " + totalLen + ");\n"); w.write(" return new puzzle.SwedishGenerator.Dict(idx, " + totalLen + ");\n");
w.write(" }\n"); w.write(" }\n");
w.write("}\n"); w.write("}\n");
@@ -136,24 +134,24 @@ public final class DictJavaGeneratorMulti {
} }
private static void writeLengthBundle(Path outDir, String pkg, int L, SwedishGenerator.DictEntry e) throws IOException { private static void writeLengthBundle(Path outDir, String pkg, int L, SwedishGenerator.DictEntry e) throws IOException {
long[] words = e.words(); var words = e.words();
// flatten posBitsets: [rows][cols] -> flat[] // flatten posBitsets: [rows][cols] -> flat[]
long[][] bs = e.posBitsets(); var bs = e.posBitsets();
int rows = bs.length; var rows = bs.length;
int cols = bs[0].length; var cols = bs[0].length;
long[] flat = new long[rows * cols]; var flat = new long[rows * cols];
int t = 0; var t = 0;
for (int r = 0; r < rows; r++) { for (var r = 0; r < rows; r++) {
System.arraycopy(bs[r], 0, flat, t, cols); System.arraycopy(bs[r], 0, flat, t, cols);
t += cols; t += cols;
} }
String base = "DictDataL" + L; var base = "DictDataL" + L;
// 1) chunk classes // 1) chunk classes
int wChunks = writeChunkClasses(outDir, pkg, base + "W", words, WORDS_CHUNK); var wChunks = writeChunkClasses(outDir, pkg, base + "W", words, WORDS_CHUNK);
int pChunks = writeChunkClasses(outDir, pkg, base + "P", flat, POS_CHUNK); var pChunks = writeChunkClasses(outDir, pkg, base + "P", flat, POS_CHUNK);
// 2) assembler class // 2) assembler class
writeLengthAssembler(outDir, pkg, base, L, rows, cols, words.length, flat.length, wChunks, pChunks); writeLengthAssembler(outDir, pkg, base, L, rows, cols, words.length, flat.length, wChunks, pChunks);
@@ -161,20 +159,20 @@ public final class DictJavaGeneratorMulti {
/** Writes classes like Prefix0..PrefixN each with static long[] DATA. Returns chunk count. */ /** Writes classes like Prefix0..PrefixN each with static long[] DATA. Returns chunk count. */
private static int writeChunkClasses(Path outDir, String pkg, String prefix, long[] data, int chunkSize) throws IOException { private static int writeChunkClasses(Path outDir, String pkg, String prefix, long[] data, int chunkSize) throws IOException {
int chunks = (data.length + chunkSize - 1) / chunkSize; var chunks = (data.length + chunkSize - 1) / chunkSize;
for (int ci = 0; ci < chunks; ci++) { for (var ci = 0; ci < chunks; ci++) {
int from = ci * chunkSize; var from = ci * chunkSize;
int to = Math.min(data.length, from + chunkSize); var to = Math.min(data.length, from + chunkSize);
Path out = outDir.resolve(prefix + ci + ".java"); var out = outDir.resolve(prefix + ci + ".java");
try (BufferedWriter w = writer(out)) { try (var w = writer(out)) {
w.write("package " + pkg + ";\n\n"); w.write("package " + pkg + ";\n\n");
w.write("public final class " + prefix + ci + " {\n"); w.write("public final class " + prefix + ci + " {\n");
w.write(" private " + prefix + ci + "() {}\n"); w.write(" private " + prefix + ci + "() {}\n");
w.write(" public static long[] get() {\n"); w.write(" public static long[] get() {\n");
w.write(" return new long[] { \n"); w.write(" return new long[] { \n");
for (int i = from; i < to; i++) { for (var i = from; i < to; i++) {
w.write(" " + toLongLiteral(data[i]) + (i + 1 < to ? "," : "") + "\n"); w.write(" " + toLongLiteral(data[i]) + (i + 1 < to ? "," : "") + "\n");
} }
w.write(" };\n"); w.write(" };\n");
@@ -189,8 +187,8 @@ public final class DictJavaGeneratorMulti {
int rows, int cols, int rows, int cols,
int wordsLen, int posLen, int wordsLen, int posLen,
int wChunks, int pChunks) throws IOException { int wChunks, int pChunks) throws IOException {
Path out = outDir.resolve(cls + ".java"); var out = outDir.resolve(cls + ".java");
try (BufferedWriter w = writer(out)) { try (var w = writer(out)) {
w.write("package " + pkg + ";\n\n"); w.write("package " + pkg + ";\n\n");
w.write("public final class " + cls + " {\n"); w.write("public final class " + cls + " {\n");
w.write(" private " + cls + "() {}\n\n"); w.write(" private " + cls + "() {}\n\n");
@@ -203,13 +201,13 @@ public final class DictJavaGeneratorMulti {
// assemble words // assemble words
w.write(" private static long[] words() {\n"); w.write(" private static long[] words() {\n");
String wPrefix = "DictDataL" + L + "W"; var wPrefix = "DictDataL" + L + "W";
if (wChunks == 1) { if (wChunks == 1) {
w.write(" return " + wPrefix + "0.get();\n"); w.write(" return " + wPrefix + "0.get();\n");
} else { } else {
w.write(" long[] out = new long[WORDS_LEN];\n"); w.write(" long[] out = new long[WORDS_LEN];\n");
w.write(" int k = 0;\n"); w.write(" int k = 0;\n");
for (int ci = 0; ci < wChunks; ci++) { for (var ci = 0; ci < wChunks; ci++) {
w.write(" k = copy(out, k, " + wPrefix + ci + ".get());\n"); w.write(" k = copy(out, k, " + wPrefix + ci + ".get());\n");
} }
w.write(" return out;\n"); w.write(" return out;\n");
@@ -218,13 +216,13 @@ public final class DictJavaGeneratorMulti {
// assemble pos // assemble pos
w.write(" private static long[] posFlat() {\n"); w.write(" private static long[] posFlat() {\n");
String pPrefix = "DictDataL" + L + "P"; var pPrefix = "DictDataL" + L + "P";
if (pChunks == 1) { if (pChunks == 1) {
w.write(" return " + pPrefix + "0.get();\n"); w.write(" return " + pPrefix + "0.get();\n");
} else { } else {
w.write(" long[] out = new long[POS_LEN];\n"); w.write(" long[] out = new long[POS_LEN];\n");
w.write(" int k = 0;\n"); w.write(" int k = 0;\n");
for (int ci = 0; ci < pChunks; ci++) { for (var ci = 0; ci < pChunks; ci++) {
w.write(" k = copy(out, k, " + pPrefix + ci + ".get());\n"); w.write(" k = copy(out, k, " + pPrefix + ci + ".get());\n");
} }
w.write(" return out;\n"); w.write(" return out;\n");
@@ -271,33 +269,6 @@ public final class DictJavaGeneratorMulti {
static int SIMPEL_IDX = 2; static int SIMPEL_IDX = 2;
public static int lineToSimpel(String line) {
var parts = line.split(",", 4);
return Integer.parseInt(parts[SIMPEL_IDX].trim());
}
public static String[] lineToClue(String line) {
if (line.isBlank()) throw new RuntimeException("Empty line");
var parts = line.split(",", 4);
var rawClue = parts[3].trim();
if (rawClue.startsWith("\"") && rawClue.endsWith("\"")) {
rawClue = rawClue.substring(1, rawClue.length() - 1).replace("\"\"", "\"");
}
return Meta.GSON.fromJson(rawClue, String[].class);
}
public static void lineToLemma(String line, LongConsumer ok) {
if (line.isBlank()) {
throw new RuntimeException("Empty line");
}
var parts = line.split(",", 4);
var word = parts[0].trim();
int score = Integer.parseInt(parts[1].trim());
int simpel = Integer.parseInt(parts[2].trim());
if (score < 1 || simpel > THRESS) {
if (Main.VERBOSE) System.err.println("Word too complex: " + line);
return;
}
ok.accept(Lemma.from(word.getBytes(US_ASCII)));
}
} }
record DictEntryDTO(LongArrayList words, IntListDTO[][] pos) { record DictEntryDTO(LongArrayList words, IntListDTO[][] pos) {
@@ -313,14 +284,10 @@ public final class DictJavaGeneratorMulti {
int[] data = new int[8]; int[] data = new int[8];
int size = 0; int size = 0;
public IntListDTO(int size) {
data = new int[size];
}
void add(int v) { void add(int v) {
if (size >= data.length) data = Arrays.copyOf(data, data.length * 2); if (size >= data.length) data = Arrays.copyOf(data, data.length * 2);
data[size++] = v; data[size++] = v;
} }
int[] toArray() { return Arrays.copyOf(data, size); }
} }
} }
@@ -342,8 +309,8 @@ public final class DictJavaGeneratorMulti {
} }
void grow() { void grow() {
int newCap = a.length == 0 ? 1 : a.length * 2; var newCap = a.length == 0 ? 1 : a.length * 2;
long[] n = new long[newCap]; var n = new long[newCap];
System.arraycopy(a, 0, n, 0, size); System.arraycopy(a, 0, n, 0, size);
a = n; a = n;
} }

View File

@@ -57,7 +57,7 @@ public class MainTest {
this.tries = 1; this.tries = 1;
this.verbose = false; this.verbose = false;
}}; }};
static final Dict dict = DictData.DICT;//loadDict(opts.wordsPath); static final Dict dict = DictData.DICT;//loadDict(opts.wordsPath);
@Test @Test
void testExtractSlots() { void testExtractSlots() {
@@ -169,18 +169,6 @@ public class MainTest {
clues.setClueLo(idx.lo, CLUE_LEFT); clues.setClueLo(idx.lo, CLUE_LEFT);
Assertions.assertTrue(clues.isClueLo(idx.index)); Assertions.assertTrue(clues.isClueLo(idx.index));
} }
/*@Test
void testMaskerCreation() {
var masker = new Masker(new Rng(12348), new int[STACK_SIZE], Masker.Clues.createEmpty());
var mask = masker.generateMask(opts.clueSize, opts.pop, opts.gens, opts.offspring);
val clued = new Clued(mask);
val map = clued.stream().collect(Collectors.toMap(ClueAt::index, ClueAt::clue));
Assertions.assertEquals(4, map.size());
Assertions.assertEquals(RIGHT.dir, map.get(0));
Assertions.assertEquals(RIGHT.dir, map.get(2));
Assertions.assertEquals(RIGHT.dir, map.get(5));
Assertions.assertEquals(LEFT.dir, map.get(71));
}*/
@Test @Test
void testFiller2() { void testFiller2() {
val rng = new Rng(-343913721); val rng = new Rng(-343913721);