Search in sources :

Example 21 with PatternGenerator

use of common.pattern.PatternGenerator in project solution-finder by knewjade.

the class CheckerNoHoldInvokerTest method testCase14.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testCase14(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    // Invoker
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
    int maxClearLine = 4;
    int maxDepth = 4;
    // Field
    String marks = "" + "XXXX______" + "XXXX_____X" + "XXXXXXXXXX" + "XXXX_____X" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: myself 20170415
    assertThat(tree.getSuccessPercent()).isEqualTo(309 / 2520.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 22 with PatternGenerator

use of common.pattern.PatternGenerator in project solution-finder by knewjade.

the class CheckerUsingHoldInvokerTest method testSearch7.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch7(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
    int maxClearLine = 4;
    int maxDepth = 4;
    String marks = "" + "XXXXX_____" + "XXXXXX____" + "XXXXXXX___" + "XXXXXX____" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: twitter by @???
    assertThat(tree.getSuccessPercent()).isEqualTo(1672 / 2520.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 23 with PatternGenerator

use of common.pattern.PatternGenerator in project solution-finder by knewjade.

the class CheckerUsingHoldInvokerTest method testSearch8.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch8(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
    int maxClearLine = 4;
    int maxDepth = 4;
    String marks = "" + "XXXXXX____" + "XXXXX_____" + "XXXXXX____" + "XXXXXXX___" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: twitter by @???
    assertThat(tree.getSuccessPercent()).isEqualTo(1928 / 2520.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 24 with PatternGenerator

use of common.pattern.PatternGenerator in project solution-finder by knewjade.

the class CheckerUsingHoldInvokerTest method testSearch10.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch10(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("T, *p4");
    int maxClearLine = 4;
    int maxDepth = 4;
    String marks = "" + "XXXXXX____" + "XXXXXX____" + "XXXXXX____" + "XXXXXX____" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: Nilgiri: https://docs.google.com/spreadsheets/d/1bVY3t_X96xRmUL0qdgB9tViSIGenu6RMKX4RW7qWg8Y/edit#gid=0
    assertThat(tree.getSuccessPercent()).isEqualTo(744 / 840.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 25 with PatternGenerator

use of common.pattern.PatternGenerator in project solution-finder by knewjade.

the class CheckerUsingHoldInvokerTest method testSearch5.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch5(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("J, I, Z, *p4");
    int maxClearLine = 4;
    int maxDepth = 6;
    String marks = "" + "________XX" + "XX_____XXX" + "XXX_____XX" + "XXX______X" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: myself 20170415
    assertThat(tree.getSuccessPercent()).isEqualTo(771 / 840.0);
}
Also used : PatternGenerator(common.pattern.PatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) LoadedPatternGenerator(common.pattern.LoadedPatternGenerator) AnalyzeTree(common.tree.AnalyzeTree) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Aggregations

PatternGenerator (common.pattern.PatternGenerator)71 LoadedPatternGenerator (common.pattern.LoadedPatternGenerator)67 Test (org.junit.jupiter.api.Test)35 LongPieces (common.datastore.blocks.LongPieces)34 AnalyzeTree (common.tree.AnalyzeTree)33 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)27 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)27 Piece (core.mino.Piece)13 Randoms (lib.Randoms)12 Field (core.field.Field)10 Pieces (common.datastore.blocks.Pieces)9 MinoFactory (core.mino.MinoFactory)9 LongTest (module.LongTest)9 Action (common.datastore.action.Action)6 LockedCandidate (core.action.candidate.LockedCandidate)6 MinoShifter (core.mino.MinoShifter)6 HashSet (java.util.HashSet)6 PerfectValidator (searcher.common.validator.PerfectValidator)6 EntryPoint (entry.EntryPoint)5 ColorConverter (common.tetfu.common.ColorConverter)4