Compare commits

..

No commits in common. "fdb4eb3d57d6e3e8e763069007492d9e86d6ba33" and "a8406bbc9aa036b215744587967b70510d5d2e04" have entirely different histories.

2 changed files with 14 additions and 44 deletions

View File

@ -1,6 +1,3 @@
/**
* A collection of helper functions for common utility tasks.
*/
object HelperFunctions {
/**
* Computes the total number of steps needed to process the given total volume.

View File

@ -1,27 +1,9 @@
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) {
@ -35,19 +17,19 @@ interface Orchestrator {
/**
* Performs a repetitive task multiple times.
* Performs a loop to repeatedly execute a task for automated steps.
*
* This handles iterating over the loop, tracking progress, and calling the provided task function each iteration.
* @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.
*
* @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.
* 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.
*/
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"
}
@ -63,23 +45,14 @@ interface Orchestrator {
HelperFunctions.report(i + 1, totalSteps, System.currentTimeMillis() - start)
task(this)
}
print("\r ")
println()
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)
}
}