Compare commits

..

No commits in common. "7dfbdc1d6207144c611f062824a04f7b4b0c102a" and "0f796c32ae85714f8ea0bdd6877efc5d04110a01" have entirely different histories.

6 changed files with 2 additions and 198 deletions

1
10/.gitignore vendored
View File

@ -1 +0,0 @@
Main.class

View File

@ -1,48 +0,0 @@
import java.io.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.lang.Math;
public class Main {
static int instructionCounter = 1;
static int registerX = 1;
static int signalStrenghts = 0;
public static String getCurrentPixel() {
String s = "";
int crtPos = (instructionCounter - 1) % 40;
// System.out.printf("crtpos: %d\n", crtPos);
if (Math.abs(registerX - 1 - crtPos) <= 1) { s = ""; }
else { s = " "; }
if (instructionCounter % 40 == 0) { s += "\r\n"; }
return s;
}
public static void instructionFinished() {
System.out.print(getCurrentPixel());
instructionCounter++;
if (instructionCounter >= 20 && (instructionCounter - 20) % 40 == 0) {
signalStrenghts += registerX * instructionCounter;
}
}
public static void main(String[] args) throws IOException {
String input = Files.readString(Path.of(args[0]));
String separator = System.getProperty("line.separator");
int index = 0;
while (true) {
int nextIndex = input.indexOf(separator, index + separator.length());
if (nextIndex < 0) { break; };
String line = input.substring(index, nextIndex);
instructionFinished();
if (!line.equals("noop")) {
int val = Integer.parseInt(line.split(" ")[1]);
registerX += val;
instructionFinished();
}
index = nextIndex + 1;
}
System.out.printf("The sum of the signal strengths is: %d\n", signalStrenghts);
}
}

View File

@ -1,8 +0,0 @@
# [Day 10](https://adventofcode.com/2022/day/10)
:gift::gift::gift::gift::gift::gift::gift::gift::gift::gift:
Today's language: **Java**
```shell
```

View File

@ -1,139 +0,0 @@
noop
noop
noop
addx 6
addx -1
noop
addx 5
noop
noop
addx -12
addx 19
addx -1
noop
addx 4
addx -11
addx 16
noop
noop
addx 5
addx 3
addx -2
addx 4
noop
noop
noop
addx -37
noop
addx 3
addx 2
addx 5
addx 2
addx 10
addx -9
noop
addx 1
addx 4
addx 2
noop
addx 3
addx 2
addx 5
addx 2
addx 3
addx -2
addx 2
addx 5
addx -40
addx 25
addx -22
addx 2
addx 5
addx 2
addx 3
addx -2
noop
addx 23
addx -18
addx 2
noop
noop
addx 7
noop
noop
addx 5
noop
noop
noop
addx 1
addx 2
addx 5
addx -40
addx 3
addx 8
addx -4
addx 1
addx 4
noop
noop
noop
addx -8
noop
addx 16
addx 2
addx 4
addx 1
noop
addx -17
addx 18
addx 2
addx 5
addx 2
addx 1
addx -11
addx -27
addx 17
addx -10
addx 3
addx -2
addx 2
addx 7
noop
addx -2
noop
addx 3
addx 2
noop
addx 3
addx 2
noop
addx 3
addx 2
addx 5
addx 2
addx -5
addx -2
addx -30
addx 14
addx -7
addx 22
addx -21
addx 2
addx 6
addx 2
addx -1
noop
addx 8
addx -3
noop
addx 5
addx 1
addx 4
noop
addx 3
addx -2
addx 2
addx -11
noop
noop
noop

View File

@ -3,7 +3,7 @@
Today's language: **gnu x86-64** (and alternatively **C**) Today's language: **gnu x86-64** (and alternatively **C**)
Today I wanted to use ChatGPT to solve the tasks using *gnu* **x86-64 assembly**, which I have never used before Today I wanted to use OpenAI to solve the tasks using *gnu* **x86-64 assembly**, which I have never used before
(I did some small things in [6502-asssembly](https://github.com/MatthiasQuintern/6502), so it wasn't all new). (I did some small things in [6502-asssembly](https://github.com/MatthiasQuintern/6502), so it wasn't all new).
The prompt can be seen in `prompt.md`, the original file in `day4-by-ai.s`. The prompt can be seen in `prompt.md`, the original file in `day4-by-ai.s`.
It did a lot of things right, however it also did a lot of things wrong: It did a lot of things right, however it also did a lot of things wrong:

View File

@ -9,7 +9,7 @@ The directories for each day contain my input file, my code and a README that sh
## Recommended Days ## Recommended Days
These are the days with to most interesting code so far: These are the days with to most interesting code so far:
1. **day 4**: *x86-64 assembly* with the help of ChatGPT 1. **day 4**: *x86-64 assembly* with the help of OpenAI
2. **day 6**: *html+javascript* [check it out here](https://quintern.xyz/advent22/day6.html) 2. **day 6**: *html+javascript* [check it out here](https://quintern.xyz/advent22/day6.html)
3. **day 7**: *awk+bash* 3. **day 7**: *awk+bash*