8000 Move 2024 day 17 part 2 reverse engineering to separate files · sim642/adventofcode@2b5b14b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b5b14b

Browse files
committed
Move 2024 day 17 part 2 reverse engineering to separate files
1 parent e261d87 commit 2b5b14b

File tree

5 files changed

+27
-40
lines changed

5 files changed

+27
-40
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bst 4 // a
2+
bxl 1
3+
cdv 5 // b
4+
bxl 5
5+
bxc 5 // -
6+
adv 3
7+
out 5 // b
8+
jnz 0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
do {
2+
b = a & 0b111
3+
b = b ^ 1
4+
c = a / (1 << b)
5+
b = b ^ 5
6+
b = b ^ c
7+
a = a / (1 << 3)
8+
output(b & 0b111)
9+
} while (a != 0)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
do {
2+
b = a & 0b111
3+
b = b ^ 1
4+
c = a >> b
5+
b = b ^ 5
6+
b = b ^ c
7+
a = a >> 3
8+
output(b & 0b111)
9+
} while (a != 0)

src/main/scala/eu/sim642/adventofcode2024/Day17.scala

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,7 @@ object Day17 {
128128
lazy val input: String = scala.io.Source.fromInputStream(getClass.getResourceAsStream("day17.txt")).mkString.trim
129129

130130
def main(args: Array[String]): Unit = {
131-
/*var a: Int = 30344604
132-
var b: Int = 0
133-
var c: Int = 0
134-
while (a != 0) {
135-
b = a & 0b111
136-
b = b ^ 1
137-
c = a >> b
138-
b = b ^ 5
139-
b = b ^ c
140-
a = a >> 3
141-
print(b & 0b111)
142-
print(',')
143-
}*/
144-
145-
146-
//println(runOutput(parseInput(input)))
131+
println(runOutput(parseInput(input)))
147132
println(findQuineA3(parseInput(input)))
148133

149134
// part 2: 164540892147389 - correct

src/test/scala/eu/sim642/adventofcode2024/Day17Test.scala

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,4 @@ class Day17Test extends AnyFunSuite {
4848
test("Part 2 examples") {
4949
assert(findQuineA(parseInput(exampleInput3)) == 117440)
5050
}
51-
52-
/*
53-
do {
54-
b = a & 0b111
55-
b = b ^ 1
56-
c = a / (1 << b)
57-
b = b ^ 5
58-
b = b ^ c
59-
a = a / (1 << 3)
60-
output(b & 0b111)
61-
} while (a != 0)
62-
*/
63-
64-
/*
65-
do {
66-
b = a & 0b111
67-
b = b ^ 1
68-
c = a >> b
69-
b = b ^ 5
70-
b = b ^ c
71-
a = a >> 3
72-
output(b & 0b111)
73-
} while (a != 0)
74-
*/
7551
}

0 commit comments

Comments
 (0)
0