Search in sources :

Example 36 with LoadedPatternGenerator

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

the class CheckerNoHoldInvokerTest method testSearch9.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch9(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
    int maxClearLine = 4;
    int maxDepth = 4;
    String marks = "" + "XXXXXX____" + "XXXXX_____" + "XXXXXXX___" + "XXXXXX____" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: twitter by @???
    assertThat(tree.getSuccessPercent()).isEqualTo(324 / 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 37 with LoadedPatternGenerator

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

the class CheckerNoHoldInvokerTest method testCase13.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testCase13(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    // Invoker
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p7");
    int maxClearLine = 4;
    int maxDepth = 6;
    // Field
    String marks = "" + "XXXX______" + "XXXX______" + "XXXX______" + "XXXX______" + "";
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: myself 20170415
    assertThat(tree.getSuccessPercent()).isEqualTo(1902 / 5040.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 38 with LoadedPatternGenerator

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

the class CheckerNoHoldInvokerTest method testSearch2BT4_5.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch2BT4_5(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p7");
    int maxClearLine = 6;
    int maxDepth = 7;
    String marks = "" + "XX________" + "XX________" + "XXX______X" + "XXXXXXX__X" + "XXXXXX___X" + "XXXXXXX_XX" + "";
    // 結果を集計する
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: myself 20170616
    assertThat(tree.getSuccessPercent()).isEqualTo(2228 / 5040.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 39 with LoadedPatternGenerator

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

the class CheckerNoHoldInvokerTest method testSearch1.

@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch1(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
    PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p7");
    int maxClearLine = 8;
    int maxDepth = 7;
    String marks = "" + "XXXXXX____" + "XXXXXX____" + "XXXXXX____" + "XXXXXX____" + "XXXXXX____" + "XXXXXX____" + "XXXXXXXX__" + "XXXXXXXX__" + "";
    // 結果を集計する
    ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
    AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
    // Source: myself 20170616
    assertThat(tree.getSuccessPercent()).isEqualTo(1719 / 5040.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 40 with LoadedPatternGenerator

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

the class CheckerNoHoldInvokerTest 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(180 / 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

LoadedPatternGenerator (common.pattern.LoadedPatternGenerator)61 PatternGenerator (common.pattern.PatternGenerator)61 Test (org.junit.jupiter.api.Test)35 LongPieces (common.datastore.blocks.LongPieces)31 AnalyzeTree (common.tree.AnalyzeTree)30 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)25 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)25 Piece (core.mino.Piece)11 Randoms (lib.Randoms)8 LongTest (module.LongTest)7 HashSet (java.util.HashSet)4 Pieces (common.datastore.blocks.Pieces)2 Field (core.field.Field)2 MinoFactory (core.mino.MinoFactory)2 ArrayList (java.util.ArrayList)2 Injector (com.google.inject.Injector)1 Action (common.datastore.action.Action)1 LockedCandidateThreadLocal (concurrent.LockedCandidateThreadLocal)1 LockedReachableThreadLocal (concurrent.LockedReachableThreadLocal)1 LockedCandidate (core.action.candidate.LockedCandidate)1