use of common.tree.AnalyzeTree 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);
}
use of common.tree.AnalyzeTree 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);
}
use of common.tree.AnalyzeTree in project solution-finder by knewjade.
the class CheckerUsingHoldInvokerTest 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(434 / 840.0);
}
use of common.tree.AnalyzeTree in project solution-finder by knewjade.
the class CheckerUsingHoldInvokerTest method runTestCase.
private AnalyzeTree runTestCase(ConcurrentCheckerInvoker invoker, String marks, PatternGenerator blocksGenerator, int maxClearLine, int maxDepth) throws FinderExecuteException {
List<Pieces> searchingPieces = blocksGenerator.blocksStream().collect(Collectors.toList());
Field field = FieldFactory.createField(marks);
List<Pair<Pieces, Boolean>> resultPairs = invoker.search(field, searchingPieces, maxClearLine, maxDepth);
// 結果を集計する
AnalyzeTree tree = new AnalyzeTree();
for (Pair<Pieces, Boolean> resultPair : resultPairs) {
Pieces pieces = resultPair.getKey();
Boolean result = resultPair.getValue();
tree.set(result, pieces);
}
System.out.println(tree.show());
return tree;
}
use of common.tree.AnalyzeTree in project solution-finder by knewjade.
the class CheckerUsingHoldInvokerTest method testSearch6.
@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void testSearch6(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws Exception {
PatternGenerator blocksGenerator = new LoadedPatternGenerator("*p5");
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: twitter by @???
assertThat(tree.getSuccessPercent()).isEqualTo(1776 / 2520.0);
}
Aggregations