diff --git a/src/main/kotlin/Orchestrator.kt b/src/main/kotlin/Orchestrator.kt index 33b079d..9eaa12b 100644 --- a/src/main/kotlin/Orchestrator.kt +++ b/src/main/kotlin/Orchestrator.kt @@ -1,9 +1,27 @@ import java.awt.Point +/** + * Interface for orchestrating automated interactions with the game. + * + * Implementations of this interface handle executing workflows and routines to automate + * gameplay through an [Automaton] instance. + */ interface Orchestrator { + /** + * The [Automaton] instance used by this orchestrator to interact with the game. + */ val automaton: Automaton + /** + * Scrolls out to the specified height by repeating scroll in/out operations. + * + * This handles scrolling out by the given height through a series of repeated scroll in and + * scroll out operations using the [doLoop] method. + * + * @param height The height in game coordinates to scroll out to. + * @param scrollWaitAndVariance The number of milliseconds to wait between scroll actions. + */ fun scrollOutToHeight(height: Int, scrollWaitAndVariance: Long = 10L) { automaton.sleep(1000) doLoop(height * 2, 1) { @@ -17,19 +35,19 @@ interface Orchestrator { /** - * Performs a loop to repeatedly execute a task for automated steps. + * Performs a repetitive task multiple times. * - * @param totalVolume The total number of units to process across all steps. - * @param volumePerStep The number of units to process per step. - * @param task The task function to execute on each step. It receives the Agent. + * This handles iterating over the loop, tracking progress, and calling the provided task function each iteration. * - * This method handles iterating through the steps, reporting progress, - * timing the overall execution, and calling the task on each iteration. - * - * It uses computeTotalSteps to calculate how many iterations needed based on total - * and per step volumes. The task typically simulates some action like banking. + * @param totalVolume The total number of units that need to be processed. + * @param volumePerStep The number of units to process per iteration. + * @param task The function to call each iteration, passing the Orchestrator as argument. */ - fun doLoop(totalVolume: Int, volumePerStep: Int, task: (Orchestrator) -> Unit) { + fun doLoop( + totalVolume: Int, + volumePerStep: Int, + task: (Orchestrator) -> Unit + ) { require(totalVolume > 0) { "You must make at least 1 thing in total" } @@ -45,14 +63,23 @@ interface Orchestrator { HelperFunctions.report(i + 1, totalSteps, System.currentTimeMillis() - start) task(this) } - println() + print("\r ") val finish = System.currentTimeMillis() println("Finished everything in ${HelperFunctions.prettyTimeString(finish - start)}") } + /** + * Prompts the user to input a point and returns the point. + * + * @param prompt The message to display to the user asking for a point input. + * @return The Point object based on the user's input. + */ fun promptUserForPoint(prompt: String): Point + /** + * Draws a star shape at the specified point on the screen. + * + * @param p The center point of the star to draw. + */ fun drawStar(p: Point) -} - - +} \ No newline at end of file