Class SolutionDay13
java.lang.Object
com.expedient.adventofcodejade.BaseSolution
com.expedient.adventofcodejade.solutions.year2024.SolutionDay13
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRecord representing a Claw Machine -
Constructor Summary
ConstructorsConstructorDescriptionSolutionDay13(PuzzleInput input, PuzzleInput sampleInputOne, PuzzleInput sampleInputTwo) -
Method Summary
Modifier and TypeMethodDescriptiongetMachines(PuzzleInput input, boolean partTwo) Parse the PuzzleInput into a list of MachinespartOne(PuzzleInput input) Logic for part one of the solution.partTwo(PuzzleInput input) Logic for part two of the solution.longsolveMachines(List<SolutionDay13.Machine> machines) Given a list of Machines, calculates the solution for each Machine using Cramer's rule, then discard every machine whose solution doesn't actually work.Methods inherited from class com.expedient.adventofcodejade.BaseSolution
getInput, run
-
Constructor Details
-
SolutionDay13
-
-
Method Details
-
getMachines
Parse the PuzzleInput into a list of Machines- Parameters:
input- the PuzzleInputpartTwo- whether this is part two, where a huge constant is added to the prize coords- Returns:
- A List of Machines defined by the input
-
solveMachines
Given a list of Machines, calculates the solution for each Machine using Cramer's rule, then discard every machine whose solution doesn't actually work.- Parameters:
machines- List of Machines- Returns:
- the total tokens required to win all machines
-
partOne
Description copied from class:BaseSolutionLogic for part one of the solution. Must be overridden when implementing the solution.- Specified by:
partOnein classBaseSolution- Parameters:
input- the PuzzleInput to be used for the solution- Returns:
- output of this part of the solution
-
partTwo
Description copied from class:BaseSolutionLogic for part two of the solution. Must be overridden when implementing the solution.- Specified by:
partTwoin classBaseSolution- Parameters:
input- the PuzzleInput to be used for the solution- Returns:
- output of this part of the solution
-