use of common.pattern.LoadedPatternGenerator in project solution-finder by knewjade.
the class HoldBreakEnumeratePiecesTest method enumerate2.
@Test
void enumerate2() throws Exception {
PatternGenerator generator = new LoadedPatternGenerator("*p7");
HoldBreakEnumeratePieces core = new HoldBreakEnumeratePieces(generator, 4);
Set<LongPieces> pieces = core.enumerate();
assertThat(pieces).hasSize(840);
assertThat(core.getCounter()).isEqualTo(5040);
}
use of common.pattern.LoadedPatternGenerator in project solution-finder by knewjade.
the class NormalEnumeratePiecesTest method enumerateHoldJust.
@Test
void enumerateHoldJust() throws Exception {
PatternGenerator generator = new LoadedPatternGenerator("*p3");
NormalEnumeratePieces core = new NormalEnumeratePieces(generator, 3, true);
Set<LongPieces> pieces = core.enumerate();
assertThat(pieces).hasSize(210);
assertThat(core.getCounter()).isEqualTo(210);
}
use of common.pattern.LoadedPatternGenerator in project solution-finder by knewjade.
the class NormalEnumeratePiecesTest method enumerateHoldOver3.
@Test
void enumerateHoldOver3() throws Exception {
PatternGenerator generator = new LoadedPatternGenerator("I, *p7");
NormalEnumeratePieces core = new NormalEnumeratePieces(generator, 4, true);
Set<LongPieces> pieces = core.enumerate();
assertThat(pieces).hasSize(840);
assertThat(core.getCounter()).isEqualTo(5040);
}
use of common.pattern.LoadedPatternGenerator in project solution-finder by knewjade.
the class NormalEnumeratePiecesTest method enumerateJustRandomNoHold.
@Test
void enumerateJustRandomNoHold() throws Exception {
List<Piece> failedPieces = Arrays.asList(Piece.I, Piece.O, Piece.L, Piece.J, Piece.S, Piece.Z);
List<Piece> allPieces = new ArrayList<>(Piece.valueList());
for (int size = 1; size <= 7; size++) {
PatternGenerator blocksGenerator = new LoadedPatternGenerator("T, *p" + size);
NormalEnumeratePieces core = new NormalEnumeratePieces(blocksGenerator, size + 1, false);
Set<LongPieces> pieces = core.enumerate();
for (int count = 0; count < 1000; count++) {
List<Piece> sample = new ArrayList<>();
sample.add(Piece.T);
Collections.shuffle(allPieces);
sample.addAll(allPieces.subList(0, size));
assertThat(new LongPieces(sample)).isIn(pieces);
for (Piece piece : failedPieces) {
sample.set(0, piece);
assertThat(new LongPieces(sample)).isNotIn(pieces);
}
}
}
}
use of common.pattern.LoadedPatternGenerator in project solution-finder by knewjade.
the class NormalEnumeratePiecesTest method enumerateHoldMulti.
@Test
void enumerateHoldMulti() throws Exception {
PatternGenerator generator = new LoadedPatternGenerator(Arrays.asList("T, J, O, Z, I", "J, O, S, T, Z", "T, J, O, I, S", "T, J, O, Z, I"));
NormalEnumeratePieces core = new NormalEnumeratePieces(generator, 3, true);
Set<LongPieces> pieces = core.enumerate();
assertThat(pieces).hasSize(3);
assertThat(core.getCounter()).isEqualTo(4);
}
Aggregations