introduce bitloops

This commit is contained in:
mike
2026-01-21 06:38:25 +01:00
parent dd53009e69
commit 1e13d39153
46 changed files with 51 additions and 150429 deletions

View File

@@ -1,20 +0,0 @@
package puzzle;
import static puzzle.SwedishGenerator.*;
public final class DictData {
private DictData() {}
public static final Dict DICT = build();
private static Dict build() {
DictEntry[] idx = new DictEntry[MAX_WORD_LENGTH_PLUS_ONE];
idx[2] = DictDataL2.entry();
idx[3] = DictDataL3.entry();
idx[4] = DictDataL4.entry();
idx[5] = DictDataL5.entry();
idx[6] = DictDataL6.entry();
idx[7] = DictDataL7.entry();
idx[8] = DictDataL8.entry();
return new Dict(idx, 40670);
}
}

View File

@@ -1,41 +0,0 @@
package puzzle;
public final class DictDataL2 {
private DictDataL2() {}
static final int LEN = 2;
static final int ROWS = 52;
static final int COLS = 4;
static final int WORDS_LEN = 211;
static final int POS_LEN = 208;
private static long[] words() {
return DictDataL2W0.get();
}
private static long[] posFlat() {
return DictDataL2P0.get();
}
public static SwedishGenerator.DictEntry entry() {
long[] wds = words();
long[] flat = posFlat();
long[][] pos = reshape(flat, ROWS, COLS);
return new SwedishGenerator.DictEntry(wds, pos, wds.length, (wds.length + 63) >>> 6);
}
private static int copy(long[] dst, int at, long[] src) {
System.arraycopy(src, 0, dst, at, src.length);
return at + src.length;
}
private static long[][] reshape(long[] flat, int rows, int cols) {
long[][] out = new long[rows][cols];
int k = 0;
for (int r = 0; r < rows; r++) {
System.arraycopy(flat, k, out[r], 0, cols);
k += cols;
}
return out;
}
}

View File

@@ -1,217 +0,0 @@
package puzzle;
public final class DictDataL2P0 {
private DictDataL2P0() {}
public static long[] get() {
return new long[] {
0x2210a009040800L,
0x308000004108008L,
0x0L,
0x0L,
0x0L,
0x108000010100L,
0x1240060000000L,
0x1080L,
0x0L,
0x55000200200L,
0x48000080000000L,
0x10000L,
0x2040000200000008L,
0x400L,
0x3002001000400000L,
0x0L,
0x4084630080000003L,
0xe00080000000L,
0x4100000000000081L,
0x0L,
0x0L,
0x20800L,
0x80000000000L,
0x20000L,
0x100000000010000L,
0x1000L,
0x100100000000L,
0x2000L,
0x8000000000004000L,
0x2000002010L,
0x10000000020002L,
0x4L,
0x208000000081410L,
0x1040000002000000L,
0x280000000000104L,
0x8L,
0x400100L,
0x20008000000L,
0x40000L,
0x8000L,
0x400000000000000L,
0x10000000000020L,
0x0L,
0x0L,
0x800000402000000L,
0x1L,
0x6002000000L,
0x0L,
0x804002000L,
0x2000000810000042L,
0x200080000L,
0x0L,
0x800000008200L,
0x0L,
0x8c00000000004208L,
0x1L,
0x1000000060120080L,
0x421000000400000L,
0x420L,
0x0L,
0x10000000L,
0x2000100004080L,
0x408400800000L,
0x100L,
0x0L,
0x0L,
0x20000004000000L,
0x0L,
0x44000000000L,
0x0L,
0x0L,
0x0L,
0x11080000000000L,
0x220000000L,
0x800008800L,
0x20L,
0x1000000004L,
0x0L,
0x9110000L,
0x0L,
0x100800000L,
0x4080000040840000L,
0x3050L,
0x0L,
0x0L,
0x4000401000004L,
0x10000200000L,
0x40650L,
0x20L,
0x80000080000L,
0x820000000000L,
0x0L,
0x0L,
0x0L,
0x10000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x200040L,
0x8800000000000000L,
0x4000000000000L,
0x4802L,
0x8401040016410200L,
0x800000000008a04L,
0x100000000000024L,
0x0L,
0x4000000000000000L,
0x8L,
0x8200200008000040L,
0x2000L,
0x0L,
0x1100080000000000L,
0x9403800001000L,
0x20000L,
0x202200000000000L,
0x20004000000000L,
0x2000000020008000L,
0x14L,
0x10008400008616cL,
0x6000000400000L,
0x2000L,
0x0L,
0x140000L,
0x0L,
0x4000000000L,
0x10020L,
0x0L,
0x400000000000L,
0x0L,
0x5000L,
0x80000148000000L,
0x8000000000L,
0x8001000000L,
0x200L,
0x850000080000000L,
0x8010000040120192L,
0x14000400L,
0x0L,
0x0L,
0x2000000L,
0x2000000000000L,
0x40000L,
0x20000010L,
0x4000200000000000L,
0x800020400100000L,
0x40L,
0x400000000800L,
0x0L,
0x40010200L,
0x8800L,
0x24000000020000L,
0x12a00040000L,
0x80100400000L,
0x80L,
0x2000000401L,
0x10000000L,
0x0L,
0x2L,
0x2000800000200000L,
0x8297061L,
0x101L,
0x0L,
0x80L,
0x40800000800000L,
0x10202000000L,
0x100L,
0x0L,
0x0L,
0x4040000000000000L,
0x8L,
0x8a00000002L,
0x20100000000L,
0x220808L,
0x0L,
0x1000010401001000L,
0x400000000L,
0x1000000080880000L,
0x0L,
0x8120000000000L,
0x81001020000000L,
0x420000000000000L,
0x0L,
0x8000L,
0x2000000005000400L,
0x40082L,
0x0L,
0x1000000000L,
0x408040000000000L,
0x80040000004010L,
0x400L,
0x800000L,
0x0L,
0x4900000000000L,
0x1L,
0x0L,
0x80000000L,
0x0L,
0x0L,
0x0L,
0x100000000000L,
0x10000000000000L,
0x0L,
0x0L,
0x200000000000000L,
0x0L,
0x0L
};
}
}

View File

@@ -1,220 +0,0 @@
package puzzle;
public final class DictDataL2W0 {
private DictDataL2W0() {}
public static long[] get() {
return new long[] {
0x100000001c5L,
0x90000000245L,
0x1100000000b4L,
0x1900000000a4L,
0x210000000169L,
0x2900000000b7L,
0x3100000000baL,
0x39000000020fL,
0x4100000000aaL,
0x49000000002eL,
0x5100000001c9L,
0x590000000181L,
0x610000000269L,
0x6900000000adL,
0x7100000000a8L,
0x7900000002aeL,
0x810000000027L,
0x8900000001afL,
0x9100000000c1L,
0x9900000000a9L,
0xa100000000cfL,
0xa900000001faL,
0xb1000000002aL,
0xb900000002f5L,
0xc10000000261L,
0xc9000000002cL,
0xd1000000002dL,
0xd90000000101L,
0xe10000000030L,
0xe9000000016fL,
0xf1000000010fL,
0xf90000000125L,
0x1010000000115L,
0x1090000000244L,
0x111000000026cL,
0x119000000024dL,
0x12100000002d4L,
0x12900000001c1L,
0x13100000000b2L,
0x1390000000241L,
0x1410000000265L,
0x1490000000285L,
0x1510000000032L,
0x15900000000b3L,
0x1610000000281L,
0x1690000000085L,
0x1710000000185L,
0x17900000001eeL,
0x1810000000033L,
0x1890000000081L,
0x19100000001a5L,
0x1990000000289L,
0x1a10000000133L,
0x1a900000001a1L,
0x1b10000000124L,
0x1b90000000105L,
0x1c100000000a7L,
0x1c90000000089L,
0x1d1000000002bL,
0x1d9000000012cL,
0x1e1000000026fL,
0x1e900000001e4L,
0x1f10000000045L,
0x1f90000000028L,
0x20100000001ecL,
0x209000000012dL,
0x2110000000036L,
0x2190000000041L,
0x2210000000128L,
0x22900000001ebL,
0x23100000001edL,
0x2390000000130L,
0x2410000000122L,
0x2490000000023L,
0x25100000002a4L,
0x2590000000026L,
0x26100000001e7L,
0x26900000001e8L,
0x27100000001f0L,
0x2790000000021L,
0x28100000001e2L,
0x2890000000126L,
0x29100000001b5L,
0x29900000001f7L,
0x2a10000000121L,
0x2a900000001e3L,
0x2b100000000afL,
0x2b90000000215L,
0x2c100000002b6L,
0x2c90000000149L,
0x2d100000002a1L,
0x2d900000001eaL,
0x2e100000001cdL,
0x2e90000000293L,
0x2f10000000135L,
0x2f90000000305L,
0x3010000000250L,
0x30900000001b3L,
0x3110000000276L,
0x31900000001adL,
0x3210000000283L,
0x32900000001a8L,
0x3310000000083L,
0x3390000000102L,
0x34100000001a3L,
0x349000000024aL,
0x35100000002c3L,
0x3590000000077L,
0x3610000000322L,
0x3690000000165L,
0x37100000000e5L,
0x3790000000205L,
0x381000000028fL,
0x38900000000b0L,
0x39100000000b6L,
0x39900000002c1L,
0x3a1000000012bL,
0x3a9000000008fL,
0x3b10000000209L,
0x3b90000000295L,
0x3c10000000061L,
0x3c90000000341L,
0x3d100000002cfL,
0x3d9000000003aL,
0x3e10000000069L,
0x3e900000002adL,
0x3f10000000175L,
0x3f9000000013aL,
0x40100000001e5L,
0x40900000002a8L,
0x4110000000029L,
0x419000000024eL,
0x42100000002d5L,
0x429000000002fL,
0x4310000000055L,
0x43900000002a5L,
0x44100000001e9L,
0x449000000018eL,
0x451000000012fL,
0x4590000000253L,
0x4610000000075L,
0x46900000000b5L,
0x47100000002ceL,
0x4790000000093L,
0x4810000000194L,
0x4890000000248L,
0x49100000002aaL,
0x499000000026dL,
0x4a10000000174L,
0x4a90000000256L,
0x4b100000001a4L,
0x4b90000000270L,
0x4c10000000114L,
0x4c9000000020cL,
0x4d10000000131L,
0x4d90000000054L,
0x4e10000000138L,
0x4e90000000082L,
0x4f10000000182L,
0x4f90000000263L,
0x50100000001a7L,
0x509000000020dL,
0x5110000000170L,
0x5190000000073L,
0x5210000000064L,
0x529000000006cL,
0x53100000000ccL,
0x5390000000110L,
0x5410000000216L,
0x5490000000177L,
0x55100000002c2L,
0x55900000001a6L,
0x56100000002e7L,
0x5690000000042L,
0x5710000000070L,
0x57900000002f7L,
0x5810000000062L,
0x5890000000144L,
0x59100000002faL,
0x5990000000063L,
0x5a10000000328L,
0x5a90000000291L,
0x5b10000000223L,
0x5b900000002c9L,
0x5c10000000025L,
0x5c90000000049L,
0x5d1000000028eL,
0x5d9000000016eL,
0x5e10000000264L,
0x5e90000000084L,
0x5f10000000225L,
0x5f9000000004eL,
0x60100000002eeL,
0x60900000001daL,
0x6110000000088L,
0x6190000000229L,
0x6210000000096L,
0x62900000000d3L,
0x6310000000176L,
0x63900000001a2L,
0x6410000000210L,
0x6490000000116L,
0x65100000002d6L,
0x659000000019aL,
0x66100000000e2L,
0x6690000000047L,
0x67100000000faL,
0x679000000018aL,
0x68100000000c3L,
0x6890000000066L,
0x6910000000156L
};
}
}

View File

@@ -1,42 +0,0 @@
package puzzle;
import static puzzle.SwedishGenerator.*;
public final class DictDataL3 {
private DictDataL3() {}
static final int LEN = 3;
static final int ROWS = 78;
static final int COLS = 17;
static final int WORDS_LEN = 1048;
static final int POS_LEN = 1326;
private static long[] words() {
return DictDataL3W0.get();
}
private static long[] posFlat() {
return DictDataL3P0.get();
}
public static DictEntry entry() {
long[] wds = words();
long[] flat = posFlat();
long[][] pos = reshape(flat, ROWS, COLS);
return new DictEntry(wds, pos, wds.length, (wds.length + 63) >>> 6);
}
private static int copy(long[] dst, int at, long[] src) {
System.arraycopy(src, 0, dst, at, src.length);
return at + src.length;
}
private static long[][] reshape(long[] flat, int rows, int cols) {
long[][] out = new long[rows][cols];
int k = 0;
for (int r = 0; r < rows; r++) {
System.arraycopy(flat, k, out[r], 0, cols);
k += cols;
}
return out;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,41 +0,0 @@
package puzzle;
public final class DictDataL4 {
private DictDataL4() {}
static final int LEN = 4;
static final int ROWS = 104;
static final int COLS = 41;
static final int WORDS_LEN = 2605;
static final int POS_LEN = 4264;
private static long[] words() {
return DictDataL4W0.get();
}
private static long[] posFlat() {
return DictDataL4P0.get();
}
public static SwedishGenerator.DictEntry entry() {
long[] wds = words();
long[] flat = posFlat();
long[][] pos = reshape(flat, ROWS, COLS);
return new SwedishGenerator.DictEntry(wds, pos, wds.length, (wds.length + 63) >>> 6);
}
private static int copy(long[] dst, int at, long[] src) {
System.arraycopy(src, 0, dst, at, src.length);
return at + src.length;
}
private static long[][] reshape(long[] flat, int rows, int cols) {
long[][] out = new long[rows][cols];
int k = 0;
for (int r = 0; r < rows; r++) {
System.arraycopy(flat, k, out[r], 0, cols);
k += cols;
}
return out;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,45 +0,0 @@
package puzzle;
public final class DictDataL5 {
private DictDataL5() {}
static final int LEN = 5;
static final int ROWS = 130;
static final int COLS = 70;
static final int WORDS_LEN = 4434;
static final int POS_LEN = 9100;
private static long[] words() {
return DictDataL5W0.get();
}
private static long[] posFlat() {
long[] out = new long[POS_LEN];
int k = 0;
k = copy(out, k, DictDataL5P0.get());
k = copy(out, k, DictDataL5P1.get());
return out;
}
public static SwedishGenerator.DictEntry entry() {
long[] wds = words();
long[] flat = posFlat();
long[][] pos = reshape(flat, ROWS, COLS);
return new SwedishGenerator.DictEntry(wds, pos, wds.length, (wds.length + 63) >>> 6);
}
private static int copy(long[] dst, int at, long[] src) {
System.arraycopy(src, 0, dst, at, src.length);
return at + src.length;
}
private static long[][] reshape(long[] flat, int rows, int cols) {
long[][] out = new long[rows][cols];
int k = 0;
for (int r = 0; r < rows; r++) {
System.arraycopy(flat, k, out[r], 0, cols);
k += cols;
}
return out;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,917 +0,0 @@
package puzzle;
public final class DictDataL5P1 {
private DictDataL5P1() {}
public static long[] get() {
return new long[] {
0x2c8480052e3080L,
0x8405941a12001100L,
0x145d84220a201L,
0x80884aL,
0x1000L,
0x0L,
0x1000000000L,
0xc63a51225291da20L,
0x8138e484a5b00e80L,
0x804051c4a2c03c19L,
0x43c44c090f012d0L,
0x51866079004001L,
0x3081141068094808L,
0x310442401530ac14L,
0x600908080L,
0xa06810e8a180100L,
0x204000501000128L,
0x4000c4000e808000L,
0x402002000L,
0x100000400000000L,
0x8800102000080008L,
0x4020600080000L,
0x80400001L,
0x4100000100000040L,
0x8280000000800200L,
0x2804004010L,
0x20000202000L,
0x80000300000000L,
0x200000000000L,
0x225000000L,
0x100000000000L,
0x48000000000000L,
0x2000000000002000L,
0x8000L,
0x0L,
0xa13f889e80000000L,
0xa0004221d005278L,
0xc08280aa1043059L,
0x40530000392c8000L,
0x20000244c2002829L,
0x110600100c008d08L,
0x128005c90210000L,
0xd0100000414L,
0x1000011100000640L,
0x8000000c80020001L,
0x200000220800L,
0x24000080001006L,
0x2000020004000000L,
0x2000000122000000L,
0x40200180000000L,
0x4000100002002000L,
0x2004040040000L,
0x1000000001000L,
0x410000020000180L,
0x40000000000800L,
0x2000020000L,
0x4000004000000L,
0x8002L,
0x0L,
0x0L,
0x0L,
0x20L,
0x4200000L,
0x2100L,
0x100000000000000L,
0x80002000000000L,
0x24000000000010L,
0x4L,
0x40000000L,
0x0L,
0x10000000000L,
0x400L,
0x100000000L,
0x0L,
0x8000001000000010L,
0x0L,
0x0L,
0x0L,
0x0L,
0x8002000000000L,
0x800002000000004L,
0x10L,
0x10000000000L,
0x0L,
0x8080000000L,
0x0L,
0x1000000000800000L,
0x8000000000000240L,
0x41400000000008L,
0x40000000004L,
0x8a0000000000L,
0x420004000000000L,
0x2010001000800000L,
0x20000000000802L,
0x640000001L,
0x8000000012040L,
0x4a8000000L,
0xa000000000200001L,
0x4200000000L,
0x200000a000000L,
0x0L,
0x1021000000000000L,
0x8000000000000L,
0x40000000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x8200000040L,
0x800000000L,
0x0L,
0x0L,
0x80000000010000L,
0x0L,
0x2000L,
0x0L,
0x10004001000000L,
0x4000000000008000L,
0x2000000020002L,
0x400000000000000L,
0x2000080000000000L,
0x200000000L,
0xa0041200000L,
0x800000000000L,
0x200201L,
0x20012040001L,
0x11010L,
0x0L,
0x19000200200L,
0x2000000800000L,
0x440000L,
0x0L,
0x810000000L,
0x0L,
0x0L,
0x1000000000L,
0x40000000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x2000000000020000L,
0x90000000L,
0x4000001000000L,
0x0L,
0x0L,
0x820000000000000L,
0x0L,
0x0L,
0x800000000000000L,
0x0L,
0x0L,
0x100L,
0x0L,
0x1000000000000L,
0x0L,
0x20004L,
0x0L,
0x0L,
0x40L,
0x400000L,
0x40L,
0x0L,
0x1012000L,
0x100L,
0x100000000000L,
0x1000040000000001L,
0x8000L,
0x200000L,
0x2000000000010000L,
0x200000000000000L,
0x6000000000L,
0x1000000080000080L,
0x2090004400000001L,
0x2100000040008000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x8000000000000000L,
0x100000000000L,
0x40800000L,
0x1000000000040008L,
0x2008000000000000L,
0x0L,
0x4000800000L,
0x800000000L,
0x200004400000000L,
0x2000008000L,
0x0L,
0x20000L,
0x40000L,
0x10L,
0x4080000000000000L,
0xa0000000000000L,
0x6001000040800000L,
0x8080L,
0x80000040L,
0x100000400L,
0xa000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x1280000000b80080L,
0x20110a1000400200L,
0x10b0010931L,
0x50880200c0008010L,
0x108c000200010120L,
0x2100081000000000L,
0x8800200c000800L,
0x0L,
0x0L,
0x18000a5460000L,
0x16c01008000c4012L,
0x44000400180a4100L,
0xa080201100044101L,
0x4808000200000000L,
0x800020000000004L,
0x8490000002800081L,
0x228b01000000140L,
0x4480108020404000L,
0x4000400020002400L,
0x281030100021000L,
0x800100260800200L,
0x8004000042000200L,
0x1010000044000200L,
0x100000108000200L,
0x5300000000080020L,
0x0L,
0x2000100000000L,
0x8000000000820000L,
0x1020020L,
0x120000020000400L,
0x40000000000000L,
0x800010000000000L,
0x4000000L,
0x800000L,
0x4000000000000L,
0x800000000L,
0x30000000L,
0x210000000000L,
0x40981800420c0004L,
0x1000002010800000L,
0x81800000005000a0L,
0x600000001000200L,
0x10400084L,
0x1700001400080L,
0x800400200020000L,
0x408000a00000000L,
0x40002004840080L,
0x2200008000080a0L,
0x400000000008L,
0x40082L,
0x800L,
0x1008082000L,
0x820000004L,
0x40000000100000L,
0x20000L,
0x800040000000000L,
0x1000000000000020L,
0x1000000000000000L,
0x0L,
0x4200000L,
0x0L,
0x80000L,
0x0L,
0x100000000000L,
0x40000000000L,
0x0L,
0x0L,
0x0L,
0x8000000400000L,
0x0L,
0x10300001010L,
0x21000000L,
0x1002002000000000L,
0x400005000020L,
0x3a0000000004L,
0x200000018004080L,
0x100800400012000L,
0x800034041000L,
0x2800020022000L,
0x1000040000000000L,
0x80000000000L,
0x12010000000080a0L,
0x2100a26022000L,
0x90400100204L,
0x400000400000012L,
0x1000200000040L,
0x1000004003020000L,
0x2010a01000L,
0x120080000050000L,
0x3104000000000189L,
0x10002000000405L,
0x40008001222000L,
0x6000100a10080L,
0x808801000000002L,
0x40052000000408L,
0x10800a80000020L,
0x4000450082212440L,
0x1081004000001700L,
0x800000044080014L,
0x840111000030022L,
0x800000008102000L,
0x158c800000812L,
0x2d000309104400L,
0x41920811024022c0L,
0x89a0040041a25149L,
0x1010020a0274044L,
0x400004002000404L,
0x1400000000020002L,
0x1040010000020800L,
0x8200440042000082L,
0x841802013201L,
0x1048001210840402L,
0x6020140000060000L,
0x704604000a980008L,
0x210802448d103L,
0x4041200000804080L,
0x400024006a004400L,
0x844006413084040L,
0x6108110408244000L,
0x400000020114104L,
0x4004002240200114L,
0x4289434006020440L,
0x140010004818000L,
0x62080210040e401L,
0x510800034010201L,
0x130100401220L,
0x800084c0084084L,
0x8880000a90012L,
0x1000480008380040L,
0x200604400401245L,
0x4002040000c01008L,
0x84455a2400400300L,
0x4112882950201406L,
0x941241042d00e01L,
0x720700200180022cL,
0x8c19d2a000288L,
0x442d48284c040226L,
0x384bf1400092c224L,
0x2000000158008L,
0x4000L,
0x27024022002L,
0xa140000360000L,
0x180104602400246L,
0x820212400802082L,
0x40000000080e0400L,
0x4081048986440100L,
0x142520c963184100L,
0x112c668082132143L,
0x759c57ed5fa44da5L,
0x84000000000001eL,
0x801004000018004L,
0x2014020005010040L,
0x8000020L,
0x101800010088L,
0x242006210100000L,
0x4022048c00081020L,
0x4200010L,
0x2100004100aa1cL,
0x90160a00080000L,
0x28080000700002L,
0x26000008500802L,
0x420b134200910400L,
0xa00000a0020005L,
0x1000100050810089L,
0x8c00080101004016L,
0x280548044200201L,
0x29408a402c404004L,
0x2100d0200100020L,
0x418000200100200L,
0x500a2a0000000840L,
0xa280932080440000L,
0x800c00001010228cL,
0x199028d040008049L,
0x8200158a311a4435L,
0x2620b1e418624L,
0x982aa01102c00188L,
0x2e020480a83008L,
0x4000000000088014L,
0x8000220000400100L,
0x6103100004010700L,
0xa042840c0004112L,
0x41000c8104211000L,
0x81040c003115041L,
0x8800008020000800L,
0x6154a01808000220L,
0x8100802050000108L,
0x1800001200400202L,
0x65800a0020011004L,
0x8000a089101102a0L,
0x3410014004a0021L,
0x8923c01009c080L,
0x80109c200040500cL,
0x2420101101861L,
0x88000080a1220804L,
0xca00011400400142L,
0x2000009004240041L,
0x4a01e04105008000L,
0x44248808001040L,
0x2240a54232004000L,
0xfdc40d8048040000L,
0xa0a828380028b4L,
0x1108a009c9034c51L,
0x808473d22309cb48L,
0x3206ca0fbd0a319cL,
0x8d18c2c4225e65d1L,
0x91d62a62845ecc52L,
0x98d0145030f35451L,
0x214060f552d0803L,
0x22000212a22a1044L,
0xe38L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x40L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x800000L,
0x0L,
0x0L,
0x40000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x800000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x2000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x20000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x40000000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x800000000000000L,
0x0L,
0x0L,
0x0L,
0x10000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x800000000L,
0x0L,
0x0L,
0x0L,
0x20000000800000L,
0x0L,
0x400000000000L,
0x1000200000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x1000000000000L,
0x0L,
0x0L,
0x0L,
0x8000000000000000L,
0x1000000000000L,
0x400000080008L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x100000L,
0x200L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x1000000000000002L,
0x0L,
0x5000000000000000L,
0x2L,
0x400000L,
0x100000000000000L,
0x1000000L,
0x0L,
0x4000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x800L,
0x80L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x8L,
0x0L,
0x0L,
0x0L,
0x1000020000000000L,
0x40000000010L,
0x0L,
0x400000000000000L,
0x0L,
0x20L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x1800000000000000L,
0x40000L,
0x2L,
0x400100000000004L,
0x2000000080000L,
0x1000L,
0x408000004000L,
0x0L,
0x8000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x200101000L,
0x101L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x400000000000000L,
0x0L,
0x0L,
0x0L,
0x8000000004L,
0x0L,
0x10000000000000L,
0x10000000L,
0x0L,
0x400000000L,
0x404180240000010L,
0x8000710001000a02L,
0x7bf07889L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x2000000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x200000010000L,
0x0L,
0x2000000000000000L,
0x0L,
0x1a16848800000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x2000000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x10L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L,
0x100000000L,
0x0L,
0x0L,
0x0L,
0x0L,
0x0L
};
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +0,0 @@
package puzzle;
public final class DictDataL6 {
private DictDataL6() {}
static final int LEN = 6;
static final int ROWS = 156;
static final int COLS = 125;
static final int WORDS_LEN = 8000;
static final int POS_LEN = 19500;
private static long[] words() {
return DictDataL6W0.get();
}
private static long[] posFlat() {
long[] out = new long[POS_LEN];
int k = 0;
k = copy(out, k, DictDataL6P0.get());
k = copy(out, k, DictDataL6P1.get());
k = copy(out, k, DictDataL6P2.get());
return out;
}
public static SwedishGenerator.DictEntry entry() {
long[] wds = words();
long[] flat = posFlat();
long[][] pos = reshape(flat, ROWS, COLS);
return new SwedishGenerator.DictEntry(wds, pos, wds.length, (wds.length + 63) >>> 6);
}
private static int copy(long[] dst, int at, long[] src) {
System.arraycopy(src, 0, dst, at, src.length);
return at + src.length;
}
private static long[][] reshape(long[] flat, int rows, int cols) {
long[][] out = new long[rows][cols];
int k = 0;
for (int r = 0; r < rows; r++) {
System.arraycopy(flat, k, out[r], 0, cols);
k += cols;
}
return out;
}
}

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

@@ -1,51 +0,0 @@
package puzzle;
public final class DictDataL7 {
private DictDataL7() {}
static final int LEN = 7;
static final int ROWS = 182;
static final int COLS = 174;
static final int WORDS_LEN = 11134;
static final int POS_LEN = 31668;
private static long[] words() {
long[] out = new long[WORDS_LEN];
int k = 0;
k = copy(out, k, DictDataL7W0.get());
k = copy(out, k, DictDataL7W1.get());
return out;
}
private static long[] posFlat() {
long[] out = new long[POS_LEN];
int k = 0;
k = copy(out, k, DictDataL7P0.get());
k = copy(out, k, DictDataL7P1.get());
k = copy(out, k, DictDataL7P2.get());
k = copy(out, k, DictDataL7P3.get());
return out;
}
public static SwedishGenerator.DictEntry entry() {
long[] wds = words();
long[] flat = posFlat();
long[][] pos = reshape(flat, ROWS, COLS);
return new SwedishGenerator.DictEntry(wds, pos, wds.length, (wds.length + 63) >>> 6);
}
private static int copy(long[] dst, int at, long[] src) {
System.arraycopy(src, 0, dst, at, src.length);
return at + src.length;
}
private static long[][] reshape(long[] flat, int rows, int cols) {
long[][] out = new long[rows][cols];
int k = 0;
for (int r = 0; r < rows; r++) {
System.arraycopy(flat, k, out[r], 0, cols);
k += cols;
}
return out;
}
}

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

@@ -1,53 +0,0 @@
package puzzle;
public final class DictDataL8 {
private DictDataL8() {}
static final int LEN = 8;
static final int ROWS = 208;
static final int COLS = 207;
static final int WORDS_LEN = 13238;
static final int POS_LEN = 43056;
private static long[] words() {
long[] out = new long[WORDS_LEN];
int k = 0;
k = copy(out, k, DictDataL8W0.get());
k = copy(out, k, DictDataL8W1.get());
return out;
}
private static long[] posFlat() {
long[] out = new long[POS_LEN];
int k = 0;
k = copy(out, k, DictDataL8P0.get());
k = copy(out, k, DictDataL8P1.get());
k = copy(out, k, DictDataL8P2.get());
k = copy(out, k, DictDataL8P3.get());
k = copy(out, k, DictDataL8P4.get());
k = copy(out, k, DictDataL8P5.get());
return out;
}
public static SwedishGenerator.DictEntry entry() {
long[] wds = words();
long[] flat = posFlat();
long[][] pos = reshape(flat, ROWS, COLS);
return new SwedishGenerator.DictEntry(wds, pos, wds.length, (wds.length + 63) >>> 6);
}
private static int copy(long[] dst, int at, long[] src) {
System.arraycopy(src, 0, dst, at, src.length);
return at + src.length;
}
private static long[][] reshape(long[] flat, int rows, int cols) {
long[][] out = new long[rows][cols];
int k = 0;
for (int r = 0; r < rows; r++) {
System.arraycopy(flat, k, out[r], 0, cols);
k += cols;
}
return out;
}
}

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

@@ -6,7 +6,7 @@ public final class DictData {
public static final puzzle.SwedishGenerator.Dict DICT800 = build();
private static puzzle.SwedishGenerator.Dict build() {
puzzle.SwedishGenerator.DictEntry[] idx = new puzzle.SwedishGenerator.DictEntry[puzzle.SwedishGenerator.MAX_WORD_LENGTH_PLUS_ONE];
puzzle.SwedishGenerator.DictEntry[] idx = new puzzle.SwedishGenerator.DictEntry[9];
idx[2] = DictDataL2.entry();
idx[3] = DictDataL3.entry();
idx[4] = DictDataL4.entry();

View File

@@ -6,7 +6,7 @@ public final class DictData {
public static final puzzle.SwedishGenerator.Dict DICT900 = build();
private static puzzle.SwedishGenerator.Dict build() {
puzzle.SwedishGenerator.DictEntry[] idx = new puzzle.SwedishGenerator.DictEntry[puzzle.SwedishGenerator.MAX_WORD_LENGTH_PLUS_ONE];
puzzle.SwedishGenerator.DictEntry[] idx = new puzzle.SwedishGenerator.DictEntry[9];
idx[2] = DictDataL2.entry();
idx[3] = DictDataL3.entry();
idx[4] = DictDataL4.entry();

View File

@@ -16,7 +16,7 @@ import static puzzle.Export.Clue.DOWN0;
import static puzzle.Export.Clue.RIGHT1;
import static puzzle.Masker.Clues.createEmpty;
import static puzzle.Masker.Slot;
import static puzzle.SwedishGenerator.C;
import static puzzle.Masker.C;
import static puzzle.SwedishGenerator.Lemma;
import static puzzle.SwedishGenerator.X;
@@ -31,7 +31,7 @@ import static puzzle.SwedishGenerator.X;
*/
public record Export() {
public static final ThreadLocal<byte[]> BYTES = ThreadLocal.withInitial(() -> new byte[SwedishGenerator.MAX_WORD_LENGTH]);
public static final ThreadLocal<byte[]> BYTES = ThreadLocal.withInitial(() -> new byte[8]);
static final byte CLUE_DOWN = 0;
static final byte CLUE_RIGHT = 1;
static final byte CLUE_UP = 2;
@@ -101,9 +101,6 @@ public record Export() {
return stream.build();
}
public Slotinfo[] slots() {
return slots(DictData.DICT);
}
public Slotinfo[] slots(Dict D) {
return Masker.slots(c, D.index());
}
@@ -237,7 +234,8 @@ public record Export() {
return new ExportedPuzzle(grid.exportGrid(_ -> '#', '#'), new WordOut[0], 1, rewards);
}
var placed = Arrays.stream(slots).map(slot -> new Placed(slot.assign().w, slot.key(), Gridded.cellWalk((byte) slot.key(), slot.lo(), slot.hi()).toArray())).toArray(Placed[]::new);
var placed = Arrays.stream(slots).map(slot -> new Placed(slot.assign().w, slot.key(), Gridded.cellWalk((byte) slot.key(), slot.lo(), slot.hi()).toArray())).toArray(
Placed[]::new);
// 2) bounding box around all word cells + arrow cells, with 1-cell margin
int minR = Integer.MAX_VALUE, minC = Integer.MAX_VALUE;

View File

@@ -349,7 +349,7 @@ public class Main {
}
}
static Clues generateNewClues(Rng rng, Opts opts) {
var masker = new Masker(rng, new int[STACK_SIZE], Masker.Clues.createEmpty());
var masker = new Masker(rng, new int[Masker.STACK_SIZE], Masker.Clues.createEmpty());
return masker.generateMask(opts.clueSize, opts.pop, opts.gens, opts.offspring);
}
static PuzzleResult _attempt(Rng rng, Dict dict, Opts opts) {

View File

@@ -18,6 +18,11 @@ public final class Masker {
public static final long[] PATH_HI = Neighbors9x8.PATH_HI;
public static final long MASK_LO = -1L;
public static final long MASK_HI = Neighbors9x8.MASK_HI;//(1L << (SIZE - 64)) - 1;
public static final int MIN_LEN = Neighbors9x8.MIN_LEN;//Config.MIN_LEN;
public static final int STACK_SIZE = 128;
public static final int C = Neighbors9x8.C;
public static final int R = Neighbors9x8.R;
public static final double SIZED = Neighbors9x8.SIZED;// ~18
private final Rng rng;
private final int[] stack;
private final Clues cache;
@@ -134,9 +139,9 @@ public final class Masker {
var hitsLo = rayLo & lo;
var hitsHi = rayHi & hi;
if (hitsHi != X) return (Long.bitCount(rayHi & -(1L << 63 - numberOfLeadingZeros(hitsHi) << 1)) >= SwedishGenerator.MIN_LEN);
else if (hitsLo != X) return (Long.bitCount(rayLo & -(1L << 63 - numberOfLeadingZeros(hitsLo) << 1)) + Long.bitCount(rayHi) >= SwedishGenerator.MIN_LEN);
else return (Long.bitCount(rayLo) + Long.bitCount(rayHi) >= SwedishGenerator.MIN_LEN);
if (hitsHi != X) return (Long.bitCount(rayHi & -(1L << 63 - numberOfLeadingZeros(hitsHi) << 1)) >= MIN_LEN);
else if (hitsLo != X) return (Long.bitCount(rayLo & -(1L << 63 - numberOfLeadingZeros(hitsLo) << 1)) + Long.bitCount(rayHi) >= MIN_LEN);
else return (Long.bitCount(rayLo) + Long.bitCount(rayHi) >= MIN_LEN);
}
private static boolean validSlot(long lo, long hi, int key) {
var rayLo = PATH_LO[key];
@@ -144,9 +149,9 @@ public final class Masker {
var hitsLo = rayLo & lo;
var hitsHi = rayHi & hi;
if (hitsLo != X) return (Long.bitCount(rayLo & ((1L << numberOfTrailingZeros(hitsLo)) - 1)) >= SwedishGenerator.MIN_LEN);
else if (hitsHi != X) return (Long.bitCount(rayLo) + Long.bitCount(rayHi & ((1L << numberOfTrailingZeros(hitsHi)) - 1)) >= SwedishGenerator.MIN_LEN);
else return (Long.bitCount(rayLo) + Long.bitCount(rayHi) >= SwedishGenerator.MIN_LEN);
if (hitsLo != X) return (Long.bitCount(rayLo & ((1L << numberOfTrailingZeros(hitsLo)) - 1)) >= MIN_LEN);
else if (hitsHi != X) return (Long.bitCount(rayLo) + Long.bitCount(rayHi & ((1L << numberOfTrailingZeros(hitsHi)) - 1)) >= MIN_LEN);
else return (Long.bitCount(rayLo) + Long.bitCount(rayHi) >= MIN_LEN);
}
private static void processSlot(Clues c, SlotVisitor visitor, int key) {
var rayLo = PATH_LO[key];

View File

@@ -40,21 +40,12 @@ import static java.nio.charset.StandardCharsets.US_ASCII;
)
public record SwedishGenerator() {
public static final long X = 0L;
public static final int C = Neighbors9x8.C;
public static final int R = Neighbors9x8.R;
public static final int SIZE = Neighbors9x8.SIZE;// ~18
public static final int SIZE_MIN_1 = Neighbors9x8.SIZE_MIN_1;// ~18
public static final double SIZED = Neighbors9x8.SIZED;// ~18
public static final int MAX_WORD_LENGTH = Neighbors9x8.R;
public static final int MAX_WORD_LENGTH_PLUS_ONE = MAX_WORD_LENGTH + 1;
public static final int MIN_LEN = Neighbors9x8.MIN_LEN;//Config.MIN_LEN;
public static final int MAX_TRIES_PER_SLOT = 500;//Config.MAX_TRIES_PER_SLOT;
public static final int STACK_SIZE = 128;
public static final long RANGE_0_SIZE = Neighbors9x8.RANGE_0_SIZE;// (long) SIZE_MIN_1 - 0L + 1L
public static final long RANGE_0_624 = Neighbors9x8.RANGE_0_624;//624L - 0L + 1L;
static final int PICK_NOT_DONE = -1;
static final int PICK_DONE = 0;
public static final long X = 0L;
public static final int SIZE = Neighbors9x8.SIZE;// ~18
public static final int MAX_TRIES_PER_SLOT = 500;//Config.MAX_TRIES_PER_SLOT;
public static final long RANGE_0_SIZE = Neighbors9x8.RANGE_0_SIZE;// (long) SIZE_MIN_1 - 0L + 1L
public static final long RANGE_0_624 = Neighbors9x8.RANGE_0_624;//624L - 0L + 1L;
public static boolean isLo(int n) { return (n & 64) == 0; }
interface Bit1029 {
@@ -120,9 +111,9 @@ public record SwedishGenerator() {
for (long w = word & LETTER_MASK; w != 0; w >>>= 5) bytes[bi++] = (byte) ((w & 31) | 64);
return new String(bytes, 0, bi, US_ASCII);
}
static int unpackIndex(long w) { return (int) (w >>> 40); }
static int unpackSize(long w) { return (int) (w >>> 40) & 7; }
static int unpackLetters(long w) { return (int) (w & LETTER_MASK); }
static int unpackIndex(long w) { return (int) (w >>> 40); }
static int unpackSize(long w) { return (int) (w >>> 40) & 7; }
static int unpackLetters(long w) { return (int) (w & LETTER_MASK); }
static long pack43(long w) {
return w & INDEX_MASK;
}
@@ -213,6 +204,8 @@ public record SwedishGenerator() {
val t0 = System.currentTimeMillis();
class Solver {
static final int PICK_NOT_DONE = -1;
static final int PICK_DONE = 0;
long nodes;
long backtracks;
long glo = grid.lo, ghi = grid.hi;