use of core.mino.MinoShifter in project solution-finder by knewjade.
the class SeparableMinosTest method createSeparableMinoSet.
private Set<SeparableMino> createSeparableMinoSet() {
Randoms randoms = new Randoms();
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
int fieldHeight = randoms.nextIntClosed(1, 10);
int fieldWidth = randoms.nextIntClosed(1, 4);
SizedBit sizedBit = new SizedBit(fieldWidth, fieldHeight);
AllSeparableMinoFactory separableMinoFactory = new AllSeparableMinoFactory(minoFactory, minoShifter, sizedBit.getWidth(), sizedBit.getHeight(), sizedBit.getFillBoard());
return separableMinoFactory.create();
}
use of core.mino.MinoShifter in project solution-finder by knewjade.
the class AllSeparableMinoFactoryTest method create2x3.
@Test
void create2x3() throws Exception {
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
int width = 2;
int height = 3;
Set<SeparableMino> minos = getSeparableMinos(minoFactory, minoShifter, width, height);
assertThat(minos.stream()).hasSize(76);
assertThat(minos.stream().filter(createBlockPredicate(Piece.T))).hasSize(16);
assertThat(minos.stream().filter(createBlockPredicate(Piece.I))).hasSize(6);
assertThat(minos.stream().filter(createBlockPredicate(Piece.S))).hasSize(8);
assertThat(minos.stream().filter(createBlockPredicate(Piece.Z))).hasSize(8);
assertThat(minos.stream().filter(createBlockPredicate(Piece.O))).hasSize(6);
assertThat(minos.stream().filter(createBlockPredicate(Piece.L))).hasSize(16);
assertThat(minos.stream().filter(createBlockPredicate(Piece.J))).hasSize(16);
}
use of core.mino.MinoShifter in project solution-finder by knewjade.
the class AllSeparableMinoFactoryTest method create3x4.
@Test
void create3x4() throws Exception {
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
int width = 3;
int height = 4;
Set<SeparableMino> minos = getSeparableMinos(minoFactory, minoShifter, width, height);
assertThat(minos.stream()).hasSize(273);
assertThat(minos.stream().filter(createBlockPredicate(Piece.T))).hasSize(60);
assertThat(minos.stream().filter(createBlockPredicate(Piece.I))).hasSize(15);
assertThat(minos.stream().filter(createBlockPredicate(Piece.S))).hasSize(30);
assertThat(minos.stream().filter(createBlockPredicate(Piece.Z))).hasSize(30);
assertThat(minos.stream().filter(createBlockPredicate(Piece.O))).hasSize(18);
assertThat(minos.stream().filter(createBlockPredicate(Piece.L))).hasSize(60);
assertThat(minos.stream().filter(createBlockPredicate(Piece.J))).hasSize(60);
}
use of core.mino.MinoShifter in project solution-finder by knewjade.
the class AllSeparableMinoFactoryTest method create2x4.
@Test
void create2x4() throws Exception {
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
int width = 2;
int height = 4;
Set<SeparableMino> minos = getSeparableMinos(minoFactory, minoShifter, width, height);
for (SeparableMino separableMino : minos) {
ColumnField field = separableMino.getColumnField();
System.out.println(ColumnFieldView.toString(field, 5, 4));
System.out.println("===");
}
assertThat(minos.stream()).hasSize(182);
assertThat(minos.stream().filter(createBlockPredicate(Piece.T))).hasSize(40);
assertThat(minos.stream().filter(createBlockPredicate(Piece.I))).hasSize(10);
assertThat(minos.stream().filter(createBlockPredicate(Piece.S))).hasSize(20);
assertThat(minos.stream().filter(createBlockPredicate(Piece.Z))).hasSize(20);
assertThat(minos.stream().filter(createBlockPredicate(Piece.O))).hasSize(12);
assertThat(minos.stream().filter(createBlockPredicate(Piece.L))).hasSize(40);
assertThat(minos.stream().filter(createBlockPredicate(Piece.J))).hasSize(40);
}
use of core.mino.MinoShifter in project solution-finder by knewjade.
the class AllSeparableMinoFactoryTest method create2x5.
@Test
void create2x5() throws Exception {
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
int width = 2;
int height = 5;
Set<SeparableMino> minos = getSeparableMinos(minoFactory, minoShifter, width, height);
assertThat(minos.stream()).hasSize(360);
assertThat(minos.stream().filter(createBlockPredicate(Piece.T))).hasSize(80);
assertThat(minos.stream().filter(createBlockPredicate(Piece.I))).hasSize(20);
assertThat(minos.stream().filter(createBlockPredicate(Piece.S))).hasSize(40);
assertThat(minos.stream().filter(createBlockPredicate(Piece.Z))).hasSize(40);
assertThat(minos.stream().filter(createBlockPredicate(Piece.O))).hasSize(20);
assertThat(minos.stream().filter(createBlockPredicate(Piece.L))).hasSize(80);
assertThat(minos.stream().filter(createBlockPredicate(Piece.J))).hasSize(80);
}
Aggregations