use of common.pattern.PatternGenerator in project solution-finder by knewjade.
the class NormalEnumeratePiecesTest method enumerateHoldMulti.
@Test
void enumerateHoldMulti() throws Exception {
PatternGenerator generator = new LoadedPatternGenerator(Arrays.asList("T, J, O, Z, I", "J, O, S, T, Z", "T, J, O, I, S", "T, J, O, Z, I"));
NormalEnumeratePieces core = new NormalEnumeratePieces(generator, 3, true);
Set<LongPieces> pieces = core.enumerate();
assertThat(pieces).hasSize(3);
assertThat(core.getCounter()).isEqualTo(4);
}
use of common.pattern.PatternGenerator in project solution-finder by knewjade.
the class NormalEnumeratePiecesTest method enumerateHoldOver2.
@Test
void enumerateHoldOver2() throws Exception {
PatternGenerator generator = new LoadedPatternGenerator("*p7");
NormalEnumeratePieces core = new NormalEnumeratePieces(generator, 4, true);
Set<LongPieces> pieces = core.enumerate();
assertThat(pieces).hasSize(2520);
assertThat(core.getCounter()).isEqualTo(5040);
}
use of common.pattern.PatternGenerator in project solution-finder by knewjade.
the class CheckerNoHoldInvokerTest method testSearch3.
@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch3(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p7");
int maxClearLine = 4;
int maxDepth = 7;
String marks = "" + "X_________" + "X___X_____" + "XXXXXXX___" + "XXXXXX____" + "";
// 結果を集計する
ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
// Source: myself 20170415
assertThat(tree.getSuccessPercent()).isEqualTo(727 / 5040.0);
}
use of common.pattern.PatternGenerator in project solution-finder by knewjade.
the class CheckerNoHoldInvokerTest 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(396 / 2520.0);
}
use of common.pattern.PatternGenerator in project solution-finder by knewjade.
the class CheckerNoHoldInvokerTest method testSearch4.
@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch4(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p4");
int maxClearLine = 3;
int maxDepth = 3;
String marks = "" + "XXX____XXX" + "XXX_____XX" + "XXXX___XXX" + "";
ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
AnalyzeTree tree = runTestCase(invoker, marks, blocksGenerator, maxClearLine, maxDepth);
// Source: myself 20170415
assertThat(tree.getSuccessPercent()).isEqualTo(120 / 840.0);
}
Aggregations