Search in sources :

Example 46 with Randoms

use of lib.Randoms in project solution-finder by knewjade.

the class LongPiecesTest method createRandomSize22.

@Test
void createRandomSize22() throws Exception {
    Randoms randoms = new Randoms();
    for (int count = 0; count < 10000; count++) {
        List<Piece> blocks = randoms.blocks(22);
        Pieces pieces = new LongPieces(blocks);
        assertThat(pieces.blockStream()).containsExactlyElementsOf(blocks);
        assertThat(pieces.getPieces()).isEqualTo(blocks);
    }
}
Also used : Randoms(lib.Randoms) Piece(core.mino.Piece) Test(org.junit.jupiter.api.Test)

Example 47 with Randoms

use of lib.Randoms in project solution-finder by knewjade.

the class LongPiecesTest method equalToReadOnlyPieces.

@Test
void equalToReadOnlyPieces() throws Exception {
    Randoms randoms = new Randoms();
    for (int count = 0; count < 10000; count++) {
        int size = randoms.nextInt(1, 22);
        List<Piece> pieces = randoms.blocks(size);
        LongPieces longPieces = new LongPieces(pieces);
        Pieces readOnlyListPieces = new ReadOnlyListPieces(pieces);
        assertThat(longPieces.equals(readOnlyListPieces)).as(longPieces.getPieces().toString()).isTrue();
    }
}
Also used : Randoms(lib.Randoms) Piece(core.mino.Piece) Test(org.junit.jupiter.api.Test)

Example 48 with Randoms

use of lib.Randoms in project solution-finder by knewjade.

the class LongPiecesTest method createRandom.

@Test
void createRandom() throws Exception {
    Randoms randoms = new Randoms();
    for (int count = 0; count < 10000; count++) {
        ArrayList<Piece> blocks = new ArrayList<>(randoms.blocks(1));
        Pieces pieces = new LongPieces(blocks);
        for (int addCount = 0; addCount < 3; addCount++) {
            List<Piece> newPieces = randoms.blocks(randoms.nextInt(0, 7));
            blocks.addAll(newPieces);
            pieces = pieces.addAndReturnNew(newPieces);
        }
        assertThat(pieces.getPieces()).isEqualTo(blocks);
    }
}
Also used : Randoms(lib.Randoms) Piece(core.mino.Piece) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Example 49 with Randoms

use of lib.Randoms in project solution-finder by knewjade.

the class ReadOnlyListPiecesTest method createRandom.

@Test
void createRandom() throws Exception {
    Randoms randoms = new Randoms();
    for (int count = 0; count < 10000; count++) {
        int size = randoms.nextInt(1, 22);
        List<Piece> blocks = randoms.blocks(size);
        Pieces pieces = new ReadOnlyListPieces(blocks);
        assertThat(pieces.getPieces()).isEqualTo(blocks);
    }
}
Also used : Randoms(lib.Randoms) Piece(core.mino.Piece) Test(org.junit.jupiter.api.Test)

Example 50 with Randoms

use of lib.Randoms in project solution-finder by knewjade.

the class ReadOnlyListPiecesTest method createRandomStream.

@Test
void createRandomStream() throws Exception {
    Randoms randoms = new Randoms();
    for (int count = 0; count < 10000; count++) {
        int size = randoms.nextInt(1, 22);
        List<Piece> blocks = randoms.blocks(size);
        Pieces pieces = new ReadOnlyListPieces(blocks);
        assertThat(pieces.getPieces()).isEqualTo(blocks);
    }
}
Also used : Randoms(lib.Randoms) Piece(core.mino.Piece) Test(org.junit.jupiter.api.Test)

Aggregations

Randoms (lib.Randoms)108 Test (org.junit.jupiter.api.Test)103 Piece (core.mino.Piece)58 LongTest (module.LongTest)32 Field (core.field.Field)29 Action (common.datastore.action.Action)25 LongPieces (common.datastore.blocks.LongPieces)24 MinoFactory (core.mino.MinoFactory)20 ArrayList (java.util.ArrayList)19 LockedCandidate (core.action.candidate.LockedCandidate)17 Mino (core.mino.Mino)16 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)16 MinoShifter (core.mino.MinoShifter)14 MinoRotation (core.srs.MinoRotation)14 Rotate (core.srs.Rotate)13 Collectors (java.util.stream.Collectors)13 LoadedPatternGenerator (common.pattern.LoadedPatternGenerator)12 PatternGenerator (common.pattern.PatternGenerator)12 List (java.util.List)12 SeparableMino (searcher.pack.separable_mino.SeparableMino)12