Search in sources :

Example 11 with Mino

use of core.mino.Mino in project solution-finder by knewjade.

the class NeighborTest method getPiece.

@Test
void getPiece() {
    OriginalPiece piece = new OriginalPiece(new Mino(Piece.T, Rotate.Spawn), 1, 0, 4);
    Neighbor neighbor = new Neighbor(piece);
    assertThat(piece).isEqualTo(neighbor.getPiece());
}
Also used : Mino(core.mino.Mino) Test(org.junit.jupiter.api.Test)

Example 12 with Mino

use of core.mino.Mino in project solution-finder by knewjade.

the class NeighborTest method getNextLeftRotateSources.

@Test
void getNextLeftRotateSources() {
    OriginalPiece piece = new OriginalPiece(new Mino(Piece.T, Rotate.Spawn), 1, 0, 4);
    Neighbor neighbor = new Neighbor(piece);
    OriginalPieceFactory factory = new OriginalPieceFactory(4);
    List<OriginalPiece> pieces = new ArrayList<>(factory.create());
    Randoms randoms = new Randoms();
    List<Neighbor> samples = randoms.sample(pieces, 4).stream().map(Neighbor::new).collect(Collectors.toList());
    neighbor.updateLeftRotateSource(samples);
    assertThat(neighbor.getNextLeftRotateSources()).containsAll(samples);
}
Also used : Randoms(lib.Randoms) ArrayList(java.util.ArrayList) Mino(core.mino.Mino) Test(org.junit.jupiter.api.Test)

Example 13 with Mino

use of core.mino.Mino in project solution-finder by knewjade.

the class NeighborTest method getNextRightRotateDestinations.

@Test
void getNextRightRotateDestinations() {
    OriginalPiece piece = new OriginalPiece(new Mino(Piece.T, Rotate.Spawn), 1, 0, 4);
    Neighbor neighbor = new Neighbor(piece);
    OriginalPieceFactory factory = new OriginalPieceFactory(4);
    List<OriginalPiece> pieces = new ArrayList<>(factory.create());
    Randoms randoms = new Randoms();
    List<Neighbor> samples = randoms.sample(pieces, 4).stream().map(Neighbor::new).collect(Collectors.toList());
    neighbor.updateRightRotateDestination(samples);
    assertThat(neighbor.getNextRightRotateDestinations()).containsAll(samples);
}
Also used : Randoms(lib.Randoms) ArrayList(java.util.ArrayList) Mino(core.mino.Mino) Test(org.junit.jupiter.api.Test)

Example 14 with Mino

use of core.mino.Mino in project solution-finder by knewjade.

the class OriginalPieceTest method testEqualsDiffX.

@Test
void testEqualsDiffX() {
    OriginalPiece piece1 = new OriginalPiece(new Mino(Piece.I, Rotate.Spawn), 3, 4, 10);
    OriginalPiece piece2 = new OriginalPiece(new Mino(Piece.I, Rotate.Left), 2, 4, 10);
    assertThat(piece1.equals(piece2)).isFalse();
}
Also used : Mino(core.mino.Mino) Test(org.junit.jupiter.api.Test)

Example 15 with Mino

use of core.mino.Mino in project solution-finder by knewjade.

the class OriginalPieceTest method testHashCodeDiffBlock.

@Test
void testHashCodeDiffBlock() {
    OriginalPiece piece1 = new OriginalPiece(new Mino(Piece.I, Rotate.Spawn), 3, 4, 10);
    OriginalPiece piece2 = new OriginalPiece(new Mino(Piece.L, Rotate.Spawn), 3, 4, 10);
    assertThat(piece1.hashCode()).isNotEqualTo(piece2.hashCode());
}
Also used : Mino(core.mino.Mino) Test(org.junit.jupiter.api.Test)

Aggregations

Mino (core.mino.Mino)103 Test (org.junit.jupiter.api.Test)46 Rotate (core.srs.Rotate)27 Field (core.field.Field)24 Piece (core.mino.Piece)20 Randoms (lib.Randoms)16 MinoFactory (core.mino.MinoFactory)14 ColorType (common.tetfu.common.ColorType)12 ColoredField (common.tetfu.field.ColoredField)12 ArrayList (java.util.ArrayList)12 FullOperationWithKey (common.datastore.FullOperationWithKey)9 HashSet (java.util.HashSet)9 ColorConverter (common.tetfu.common.ColorConverter)8 OriginalPiece (core.neighbor.OriginalPiece)8 List (java.util.List)8 MinoOperationWithKey (common.datastore.MinoOperationWithKey)7 OperationWithKey (common.datastore.OperationWithKey)7 TetfuPage (common.tetfu.TetfuPage)7 Arrays (java.util.Arrays)7 Collectors (java.util.stream.Collectors)7