use of common.tree.AnalyzeTree in project solution-finder by knewjade.
the class CheckerNoHoldInvokerTest method random.
@LongTest
@ParameterizedTest
@ArgumentsSource(InvokerTestCase.class)
void random(IntFunction<ConcurrentCheckerInvoker> invokerGenerator) throws FinderExecuteException, SyntaxException {
Randoms randoms = new Randoms();
MinoFactory minoFactory = new MinoFactory();
MinoShifter minoShifter = new MinoShifter();
MinoRotation minoRotation = new MinoRotation();
PerfectValidator validator = new PerfectValidator();
CheckerNoHold<Action> checker = new CheckerNoHold<>(minoFactory, validator);
for (int count = 0; count < 40; count++) {
int maxClearLine = randoms.nextInt(3, 6);
int maxDepth = randoms.nextIntClosed(3, 5);
Candidate<Action> candidate = new LockedCandidate(minoFactory, minoShifter, minoRotation, maxClearLine);
Field field = randoms.field(maxClearLine, maxDepth);
PatternGenerator blocksGenerator = createPiecesGenerator(maxDepth);
List<Pieces> searchingPieces = blocksGenerator.blocksStream().collect(Collectors.toList());
ConcurrentCheckerInvoker invoker = invokerGenerator.apply(maxClearLine);
AnalyzeTree tree = runTestCase(invoker, field, searchingPieces, maxClearLine, maxDepth);
for (Pieces pieces : searchingPieces) {
boolean check = checker.check(field, pieces.getPieces(), candidate, maxClearLine, maxDepth);
assertThat(tree.isSucceed(pieces)).isEqualTo(check);
}
}
}
use of common.tree.AnalyzeTree in project solution-finder by knewjade.
the class CheckerNoHoldInvokerTest 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(609 / 2520.0);
}
use of common.tree.AnalyzeTree 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);
}
use of common.tree.AnalyzeTree 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);
}
use of common.tree.AnalyzeTree 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);
}
Aggregations