use of core.mino.MinoFactory in project solution-finder by knewjade.
the class LimitIterationCandidateTest method testSearch3When3Iteration.
@Test
void testSearch3When3Iteration() throws Exception {
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
MinoRotation minoRotation = new MinoRotation();
Candidate<Action> candidate = new LimitIterationCandidate(minoFactory, minoShifter, minoRotation, 3);
String marks = "" + "XXXX______" + "XX_XXXXX__" + "X___X_____" + "XX_X______";
Field field = FieldFactory.createField(marks);
Set<Action> actions = candidate.search(field, Piece.T, 4);
assertThat(actions).hasSize(9).contains(MinimalAction.create(8, 0, Rotate.Spawn)).contains(MinimalAction.create(7, 0, Rotate.Spawn)).contains(MinimalAction.create(8, 1, Rotate.Reverse)).contains(MinimalAction.create(7, 1, Rotate.Reverse)).contains(MinimalAction.create(6, 1, Rotate.Reverse)).contains(MinimalAction.create(8, 3, Rotate.Reverse)).contains(MinimalAction.create(9, 1, Rotate.Left)).contains(MinimalAction.create(8, 1, Rotate.Left)).contains(MinimalAction.create(8, 1, Rotate.Right));
}
use of core.mino.MinoFactory in project solution-finder by knewjade.
the class LimitIterationCandidateTest method testRandomLocked.
@Disabled
@Test
@LongTest
// TODO: mesure time, 移動回数をチェックしていないためテストに失敗することがある
void testRandomLocked() {
Randoms randoms = new Randoms();
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
MinoRotation minoRotation = new MinoRotation();
LimitIterationCandidate limitIterationCandidate = new LimitIterationCandidate(minoFactory, minoShifter, minoRotation, 12);
for (int count = 0; count < 10; count++) {
int randomHeight = randoms.nextIntClosed(10, 12);
int numOfMinos = randoms.nextIntClosed(4, randomHeight * 10 / 4 - 1);
Field field = randoms.field(randomHeight, numOfMinos);
int clearLine = field.clearLine();
int height = randomHeight - clearLine;
Piece piece = randoms.block();
String description = FieldView.toString(field, height) + piece;
Set<Action> actions1 = limitIterationCandidate.search(field, piece, height);
LockedCandidate lockedCandidate = new LockedCandidate(minoFactory, minoShifter, minoRotation, height);
Set<Action> actions2 = lockedCandidate.search(field, piece, height);
assertThat(actions2).as(description).isEqualTo(actions1);
}
}
use of core.mino.MinoFactory 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.mino.MinoFactory in project solution-finder by knewjade.
the class LockedNeighborCandidateTest method createLockedCandidate.
private LockedCandidate createLockedCandidate(Injector injector, int maxClearLine) {
MinoFactory minoFactory = injector.getInstance(MinoFactory.class);
MinoShifter minoShifter = injector.getInstance(MinoShifter.class);
MinoRotation minoRotation = injector.getInstance(MinoRotation.class);
return new LockedCandidate(minoFactory, minoShifter, minoRotation, maxClearLine);
}
use of core.mino.MinoFactory in project solution-finder by knewjade.
the class LockedNeighborReachableTest method createLockedReachable.
private LockedReachable createLockedReachable(Injector injector, int maxClearLine) {
MinoFactory minoFactory = injector.getInstance(MinoFactory.class);
MinoShifter minoShifter = injector.getInstance(MinoShifter.class);
MinoRotation minoRotation = injector.getInstance(MinoRotation.class);
return new LockedReachable(minoFactory, minoShifter, minoRotation, maxClearLine);
}
Aggregations