hashcode-utils-kt / org.hildan.hashcode.utils

Package org.hildan.hashcode.utils

Functions

computeHCOutputPath

Computes the output file path based on the input file path. If there is a .in extension, it is changed to .out, otherwise .out is simply appended. If there is a parent folder called inputs, it is changed to outputs.

fun computeHCOutputPath(inputPath: Path): Path

solveHCFilesInParallel

Solves the problems defined by each of the given input files, each in its own coroutine.

suspend fun solveHCFilesInParallel(vararg filenames: String, exceptionsLogger: UncaughtExceptionsLogger = UncaughtExceptionsLogger.STDERR, remindExceptionsAtTheEnd: Boolean = true, readAndSolve: suspend HCReader.() -> Iterable<CharSequence>): Unit

solveHCProblemAndWriteFile

Reads the input file at inputFilePath by calling readAndSolve, and writes the returned lines to the file at outputFilePath.

fun solveHCProblemAndWriteFile(inputFilePath: Path, outputFilePath: Path = computeHCOutputPath(inputFilePath), readAndSolve: HCReader.() -> Iterable<CharSequence>): Unit