Search in sources :

Example 1 with BasicModule

use of module.BasicModule in project solution-finder by knewjade.

the class LockedNeighborReachableTest method checks1.

@Test
void checks1() {
    int maxClearLine = 4;
    Injector injector = Guice.createInjector(new BasicModule(maxClearLine));
    LockedNeighborReachable reachable = createLockedNeighborReachable(injector, maxClearLine);
    Field field = FieldFactory.createField("" + "XXXX______" + "___X______" + "___X______" + "__________");
    assertThat(reachable.checks(field, new Mino(Piece.T, Rotate.Spawn), 8, 0, maxClearLine)).isTrue();
    assertThat(reachable.checks(field, new Mino(Piece.T, Rotate.Spawn), 1, 0, maxClearLine)).isFalse();
}
Also used : Field(core.field.Field) Injector(com.google.inject.Injector) BasicModule(module.BasicModule) Mino(core.mino.Mino) Test(org.junit.jupiter.api.Test)

Example 2 with BasicModule

use of module.BasicModule in project solution-finder by knewjade.

the class NeighborsTest method getJ.

@Test
void getJ() {
    Injector injector = Guice.createInjector(new BasicModule());
    Neighbors neighbors = createNeighbors(injector);
    Neighbor neighbor = neighbors.get(Piece.J, Rotate.Left, 3, 2);
    assertThat(neighbor.getPiece()).returns(Piece.J, OriginalPiece::getPiece).returns(Rotate.Left, OriginalPiece::getRotate).returns(3, OriginalPiece::getX).returns(2, OriginalPiece::getY);
}
Also used : Injector(com.google.inject.Injector) BasicModule(module.BasicModule) Test(org.junit.jupiter.api.Test)

Example 3 with BasicModule

use of module.BasicModule in project solution-finder by knewjade.

the class NeighborsTest method getT.

@Test
void getT() {
    Injector injector = Guice.createInjector(new BasicModule());
    Neighbors neighbors = createNeighbors(injector);
    Neighbor neighbor = neighbors.get(Piece.O, Rotate.Spawn, 1, 0);
    assertThat(neighbor.getPiece()).returns(Piece.O, OriginalPiece::getPiece).returns(Rotate.Spawn, OriginalPiece::getRotate).returns(1, OriginalPiece::getX).returns(0, OriginalPiece::getY);
}
Also used : Injector(com.google.inject.Injector) BasicModule(module.BasicModule) Test(org.junit.jupiter.api.Test)

Example 4 with BasicModule

use of module.BasicModule in project solution-finder by knewjade.

the class NeighborsTest method getS.

@Test
void getS() {
    Injector injector = Guice.createInjector(new BasicModule());
    Neighbors neighbors = createNeighbors(injector);
    Neighbor neighbor = neighbors.get(Piece.S, Rotate.Reverse, 8, 3);
    assertThat(neighbor.getPiece()).returns(Piece.S, OriginalPiece::getPiece).returns(Rotate.Reverse, OriginalPiece::getRotate).returns(8, OriginalPiece::getX).returns(3, OriginalPiece::getY);
}
Also used : Injector(com.google.inject.Injector) BasicModule(module.BasicModule) Test(org.junit.jupiter.api.Test)

Example 5 with BasicModule

use of module.BasicModule in project solution-finder by knewjade.

the class NeighborsTest method nextLeftRotateSources.

@Test
void nextLeftRotateSources() {
    Injector injector = Guice.createInjector(new BasicModule(6));
    Neighbors neighbors = createNeighbors(injector);
    Neighbor neighbor = neighbors.get(Piece.T, Rotate.Spawn, 4, 3);
    assertThat(neighbor.getNextLeftRotateSources()).containsExactlyInAnyOrder(neighbors.get(Piece.T, Rotate.Right, 4, 3), neighbors.get(Piece.T, Rotate.Right, 3, 3), neighbors.get(Piece.T, Rotate.Right, 3, 4), neighbors.get(Piece.T, Rotate.Right, 4, 1), neighbors.get(Piece.T, Rotate.Right, 3, 1));
}
Also used : Injector(com.google.inject.Injector) BasicModule(module.BasicModule) Test(org.junit.jupiter.api.Test)

Aggregations

Injector (com.google.inject.Injector)15 BasicModule (module.BasicModule)15 Test (org.junit.jupiter.api.Test)13 Field (core.field.Field)7 MinoFactory (core.mino.MinoFactory)4 Randoms (lib.Randoms)4 Action (common.datastore.action.Action)3 Mino (core.mino.Mino)3 MinoShifter (core.mino.MinoShifter)3 OriginalPiece (core.neighbor.OriginalPiece)3 OriginalPieceFactory (core.neighbor.OriginalPieceFactory)3 MinoRotation (core.srs.MinoRotation)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)3 Guice (com.google.inject.Guice)2 MinimalAction (common.datastore.action.MinimalAction)2 LoadedPatternGenerator (common.pattern.LoadedPatternGenerator)2 PatternGenerator (common.pattern.PatternGenerator)2 FieldFactory (core.field.FieldFactory)2 Piece (core.mino.Piece)2