introduce bitloops
This commit is contained in:
@@ -18,17 +18,17 @@ public class ConnectivityTest {
|
||||
// Clue 1: (0,0) Right. Slot: (0,1), (0,2), (0,3)
|
||||
// Clue 2: (1,2) Up. Slot: (0,2)
|
||||
// Ze zijn NIET 8-naburig, maar wel verbonden via slot op (0,2)
|
||||
singleComp.setClueLo(1L << SwedishGenerator.Grid.offset(0,0), (byte)1);
|
||||
singleComp.setClueLo(1L << SwedishGenerator.Grid.offset(2,2), (byte)2); // Up van (2,2) naar (1,2), (0,2)
|
||||
singleComp.setClueLo(1L << Masker.offset(0, 0), (byte)1);
|
||||
singleComp.setClueLo(1L << Masker.offset(2, 2), (byte)2); // Up van (2,2) naar (1,2), (0,2)
|
||||
|
||||
long fitnessSingle = masker.maskFitness(singleComp, 2);
|
||||
|
||||
// 2. Maak een masker met twee eilandjes van clues
|
||||
Clues twoIslands = Clues.createEmpty();
|
||||
twoIslands.setClueLo(1L << SwedishGenerator.Grid.offset(0,0), (byte)1);
|
||||
twoIslands.setClueLo( SwedishGenerator.Grid.offset(7,7) < 64 ? 1L << SwedishGenerator.Grid.offset(7,7) : 0, (byte)1);
|
||||
twoIslands.setClueLo(1L << Masker.offset(0, 0), (byte)1);
|
||||
twoIslands.setClueLo(Masker.offset(7, 7) < 64 ? 1L << Masker.offset(7, 7) : 0, (byte)1);
|
||||
// Voor de zekerheid checken we of offset(7,7) in lo of hi zit
|
||||
int off77 = SwedishGenerator.Grid.offset(7,7);
|
||||
int off77 = Masker.offset(7, 7);
|
||||
if (off77 < 64) twoIslands.setClueLo(1L << off77, (byte)1);
|
||||
else twoIslands.setClueHi(1L << (off77 - 64), (byte)1);
|
||||
|
||||
@@ -49,8 +49,8 @@ public class ConnectivityTest {
|
||||
// Twee clues naast elkaar, maar slots kruisen niet.
|
||||
// Clue 1: (1,1) Right. Slot (1,2), (1,3), (1,4)
|
||||
// Clue 2: (2,1) Right. Slot (2,2), (2,3), (2,4)
|
||||
clues.setClueLo(1L << SwedishGenerator.Grid.offset(1,1), (byte)1);
|
||||
clues.setClueLo(1L << SwedishGenerator.Grid.offset(2,1), (byte)1);
|
||||
clues.setClueLo(1L << Masker.offset(1, 1), (byte)1);
|
||||
clues.setClueLo(1L << Masker.offset(2, 1), (byte)1);
|
||||
|
||||
long fitness = masker.maskFitness(clues, 2);
|
||||
|
||||
@@ -68,8 +68,8 @@ public class ConnectivityTest {
|
||||
// Clue A: (2,0) Right. Slot: (2,1), (2,2), (2,3), ...
|
||||
// Clue B: (1,2) Corner Down. Word starts at (1,3) en gaat omlaag: (1,3), (2,3), (3,3)...
|
||||
// Ze kruisen op (2,3).
|
||||
clues.setClueLo(1L << SwedishGenerator.Grid.offset(2,0), (byte)1); // Right
|
||||
clues.setClueLo(1L << SwedishGenerator.Grid.offset(1,2), (byte)4); // Corner Down
|
||||
clues.setClueLo(1L << Masker.offset(2, 0), (byte)1); // Right
|
||||
clues.setClueLo(1L << Masker.offset(1, 2), (byte)4); // Corner Down
|
||||
|
||||
long fitness = masker.maskFitness(clues, 2);
|
||||
System.out.println("[DEBUG_LOG] Fitness corner clue connected: " + fitness);
|
||||
@@ -77,11 +77,11 @@ public class ConnectivityTest {
|
||||
// Als ze verbonden zijn, is de penalty voor eilandjes 0.
|
||||
// We vergelijken met een island scenario (2 clues die elkaar NIET raken)
|
||||
Clues island = Clues.createEmpty();
|
||||
int offA = SwedishGenerator.Grid.offset(2,0);
|
||||
int offA = Masker.offset(2, 0);
|
||||
if (offA < 64) island.setClueLo(1L << offA, (byte)1);
|
||||
else island.setClueHi(1L << (offA - 64), (byte)1);
|
||||
|
||||
int offB = SwedishGenerator.Grid.offset(7,7);
|
||||
int offB = Masker.offset(7, 7);
|
||||
if (offB < 64) island.setClueLo(1L << offB, (byte)1);
|
||||
else island.setClueHi(1L << (offB - 64), (byte)1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user