Skip to content

Commit 8703dd6

Browse files
committed
Day 20 WIP
1 parent ccb1992 commit 8703dd6

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

src/main/java/com/adventofcode/flashk/day20/Conjunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void sendPulse(Module origin, String value) {
2222
@Override
2323
public void processPulse() {
2424
if(!inputPulses.isEmpty()) {
25-
Pair<Module, String> inputPulse = inputPulses.poll();
25+
//Pair<Module, String> inputPulse = inputPulses.poll();
2626

2727
boolean isAllHigh = true;
2828
for(String memoryValue : memory.values()) {

src/main/java/com/adventofcode/flashk/day20/FlipFlop.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public FlipFlop(String name) {
1717
@Override
1818
public void sendPulse(Module origin, String value) {
1919

20-
System.out.println(origin.getName() + " -"+value+"-> " + getName());
20+
//System.out.println(origin.getName() + " -"+value+"-> " + getName());
2121

2222
// Update high and low counters
2323
if (LOW.equals(value)) {

src/main/java/com/adventofcode/flashk/day20/Module.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected Module(String name) {
3434

3535
public void sendPulse(Module origin, String value) {
3636
this.inputPulses.add(ImmutablePair.of(origin, value));
37-
System.out.println(origin.name + " -"+value+"-> " + name);
37+
//System.out.println(origin.name + " -"+value+"-> " + name);
3838

3939
// Update high and low counters
4040
if(LOW.equals(value)) {

src/main/java/com/adventofcode/flashk/day20/PulsePropagation.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public PulsePropagation(List<String> inputs) {
8989
}
9090

9191
public long solveA(int pressTimes) {
92-
System.out.println();
9392

9493
for(int i = 0; i < pressTimes; i++) {
9594
button.sendPulse(button, Module.LOW);

src/test/java/com/adventofcode/flashk/day20/Day20Test.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public void testSolvePart1Sample() {
5757
@Tag(TestTag.PART_ONE)
5858
@Tag(TestTag.SAMPLE)
5959
@DisplayName(TestDisplayName.PART_ONE_SAMPLE)
60-
@Disabled // TODO enable
6160
void testSolvePart1Sample2() {
6261

6362
System.out.print("1 | sample | ");
@@ -66,7 +65,7 @@ void testSolvePart1Sample2() {
6665
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE_SAMPLE_2);
6766

6867
PulsePropagation pulsePropagation = new PulsePropagation(inputs);
69-
long result = pulsePropagation.solveA(1);
68+
long result = pulsePropagation.solveA(1000);
7069

7170
assertEquals(11687500, result);
7271
}
@@ -76,7 +75,6 @@ void testSolvePart1Sample2() {
7675
@Tag(TestTag.PART_ONE)
7776
@Tag(TestTag.INPUT)
7877
@DisplayName(TestDisplayName.PART_ONE_INPUT)
79-
@Disabled // TODO enable
8078
public void testSolvePart1Input() {
8179

8280
System.out.print("1 | input | ");
@@ -85,9 +83,10 @@ public void testSolvePart1Input() {
8583
List<String> inputs = Input.readStringLines(INPUT_FOLDER, TestFilename.INPUT_FILE);
8684

8785
PulsePropagation pulsePropagation = new PulsePropagation(inputs);
88-
long result = pulsePropagation.solveA(1);
86+
long result = pulsePropagation.solveA(1000);
8987

9088
System.out.println("R: "+result);
89+
// 787801375 -> Too high
9190
//assertEquals(0, result);
9291
}
9392

0 commit comments

Comments
 (0)