use of common.datastore.blocks.Pieces in project solution-finder by knewjade.
the class SingleCheckerNoHoldInvoker method search.
@Override
public List<Pair<Pieces, Boolean>> search(Field field, List<Pieces> searchingPieces, int maxClearLine, int maxDepth) throws FinderExecuteException {
ConcurrentVisitedTree visitedTree = new ConcurrentVisitedTree();
Obj obj = new Obj(field, maxClearLine, maxDepth, visitedTree);
try {
ArrayList<Pair<Pieces, Boolean>> results = new ArrayList<>();
for (Pieces target : searchingPieces) {
Task task = new Task(obj, commonObj, target);
results.add(task.call());
}
return results;
} catch (Exception e) {
throw new FinderExecuteException(e);
}
}
use of common.datastore.blocks.Pieces in project solution-finder by knewjade.
the class ConcurrentCheckerUsingHoldInvoker method search.
@Override
public List<Pair<Pieces, Boolean>> search(Field field, List<Pieces> searchingPieces, int maxClearLine, int maxDepth) throws FinderExecuteException {
ConcurrentVisitedTree visitedTree = new ConcurrentVisitedTree();
Obj obj = new Obj(field, maxClearLine, maxDepth, visitedTree);
ArrayList<Task> tasks = new ArrayList<>();
for (Pieces target : searchingPieces) tasks.add(new Task(obj, commonObj, target));
try {
return execute(tasks);
} catch (InterruptedException | ExecutionException e) {
throw new FinderExecuteException(e);
}
}
use of common.datastore.blocks.Pieces in project solution-finder by knewjade.
the class SingleCheckerUsingHoldInvoker method search.
@Override
public List<Pair<Pieces, Boolean>> search(Field field, List<Pieces> searchingPieces, int maxClearLine, int maxDepth) throws FinderExecuteException {
ConcurrentVisitedTree visitedTree = new ConcurrentVisitedTree();
Obj obj = new Obj(field, maxClearLine, maxDepth, visitedTree);
ArrayList<Pair<Pieces, Boolean>> results = new ArrayList<>();
try {
for (Pieces target : searchingPieces) {
Task task = new Task(obj, commonObj, target);
Pair<Pieces, Boolean> call = task.call();
results.add(call);
}
} catch (Exception e) {
throw new FinderExecuteException(e);
}
// 結果をリストに追加する
return results;
}
use of common.datastore.blocks.Pieces in project solution-finder by knewjade.
the class PackSearcherComparingParityBasedOnDemandTest method testAllSRSValidPacksHeight4.
// 高さ4: パリティベースとの探索結果を比較する (同一ミノは2つまで)
@Test
@LongTest
void testAllSRSValidPacksHeight4() throws Exception {
int width = 3;
int height = 4;
String resultPath = ClassLoader.getSystemResource("perfects/pack_height4.txt").getPath();
List<TestData> testCases = Files.lines(Paths.get(resultPath)).map(line -> line.split("//")[0]).map(String::trim).filter(line -> !line.isEmpty()).map(line -> line.split("=")).map(split -> {
Stream<Piece> blocks = BlockInterpreter.parse(split[0]);
LongPieces pieces = new LongPieces(blocks);
int count = Integer.valueOf(split[1]);
return new TestData(pieces, count);
}).collect(Collectors.toList());
compareCount(width, height, testCases);
}
use of common.datastore.blocks.Pieces in project solution-finder by knewjade.
the class PackSearcherComparingParityBasedOnDemandTest method testAllSRSValidPacksHeight5.
// 高さ5: パリティベースとの探索結果を比較する (同一ミノは2つまで)
@Test
void testAllSRSValidPacksHeight5() throws Exception {
int width = 2;
int height = 5;
String resultPath = ClassLoader.getSystemResource("perfects/pack_height5.txt").getPath();
List<TestData> testCases = Files.lines(Paths.get(resultPath)).map(line -> line.split("//")[0]).map(String::trim).filter(line -> !line.isEmpty()).map(line -> line.split("=")).map(split -> {
Stream<Piece> blocks = BlockInterpreter.parse(split[0]);
LongPieces pieces = new LongPieces(blocks);
int count = Integer.valueOf(split[1]);
return new TestData(pieces, count);
}).collect(Collectors.toList());
compareCount(width, height, testCases);
}
Aggregations