use of core.neighbor.OriginalPieceFactory in project solution-finder by knewjade.
the class LockedNeighborCandidateTest method createLockedNeighborCandidate.
private LockedNeighborCandidate createLockedNeighborCandidate(Injector injector, int maxClearLine) {
MinoFactory minoFactory = injector.getInstance(MinoFactory.class);
MinoShifter minoShifter = injector.getInstance(MinoShifter.class);
MinoRotation minoRotation = injector.getInstance(MinoRotation.class);
OriginalPieceFactory pieceFactory = new OriginalPieceFactory(maxClearLine + 3);
return new LockedNeighborCandidate(minoFactory, minoShifter, minoRotation, pieceFactory);
}
use of core.neighbor.OriginalPieceFactory in project solution-finder by knewjade.
the class LockedNeighborReachableTest method randoms.
@Test
void randoms() {
int maxClearLine = 4;
Injector injector = Guice.createInjector(new BasicModule(maxClearLine));
LockedReachable reachable1 = createLockedReachable(injector, maxClearLine);
LockedNeighborReachable reachable2 = createLockedNeighborReachable(injector, maxClearLine);
OriginalPieceFactory pieceFactory = injector.getInstance(OriginalPieceFactory.class);
Set<OriginalPiece> pieces = pieceFactory.create();
Randoms randoms = new Randoms();
for (int count = 0; count < 10000; count++) {
Field field = randoms.field(4, 5);
for (OriginalPiece piece : pieces) {
// フィールドにそもそも置けないときは前提条件が合わないためスキップ
if (!field.canPut(piece))
continue;
Mino mino = piece.getMino();
int x = piece.getX();
int y = piece.getY();
boolean checks1 = reachable1.checks(field, mino, x, y, maxClearLine);
boolean checks2 = reachable2.checks(field, mino, x, y, maxClearLine);
assertThat(checks2).as(piece.toString()).isEqualTo(checks1);
}
}
}
Aggregations