Compare commits

..

No commits in common. "9ac24ee0fa0d5e58250530fa3e94bd1427be5281" and "7d835cdadf7d9f71f4f2ff88c51b58e7a24488c0" have entirely different histories.

2 changed files with 0 additions and 177 deletions

View File

@ -1,37 +0,0 @@
import { readFileSync } from "fs";
const input = readFileSync("instructions.txt", "utf-8");
let display = "";
function drawCRT(cycle, pointer) {
if((cycle - 1) % 40 === 0) display += "\n"
if(Math.abs(((cycle - 1) % 40) - pointer) <= 1) display += "#";
else display += ".";
}
let xRegister = 1;
let cycle = 0;
input.split('\n').forEach(line => {
const instruction = line.split(' ');
switch(instruction[0]) {
case "noop":
cycle++;
drawCRT(cycle, xRegister);
break;
case "addx":
cycle++;
drawCRT(cycle, xRegister);
cycle++;
drawCRT(cycle, xRegister);
xRegister += parseInt(instruction[1]);
break;
}
});
console.log(display)

View File

@ -1,140 +0,0 @@
addx 1
addx 4
addx -2
addx 3
addx 3
addx 1
noop
addx 5
noop
noop
noop
addx 5
addx 2
addx 3
noop
addx 2
addx 4
noop
addx -1
noop
addx 3
addx -10
addx -17
noop
addx -3
addx 2
addx 25
addx -24
addx 2
addx 5
addx 2
addx 3
noop
addx 2
addx 14
addx -9
noop
addx 5
noop
noop
addx -2
addx 5
addx 2
addx -5
noop
noop
addx -19
addx -11
addx 5
addx 3
noop
addx 2
addx 3
addx -2
addx 2
noop
addx 3
addx 4
noop
noop
addx 5
noop
noop
noop
addx 5
addx -3
addx 8
noop
addx -15
noop
addx -12
addx -9
noop
addx 6
addx 7
addx -6
addx 4
noop
noop
noop
addx 4
addx 1
addx 5
addx -11
addx 29
addx -15
noop
addx -12
addx 17
addx 7
noop
noop
addx -32
addx 3
addx -8
addx 7
noop
addx -2
addx 5
addx 2
addx 6
addx -8
addx 5
addx 2
addx 5
addx 17
addx -12
addx -2
noop
noop
addx 7
addx 9
addx -8
addx 2
addx -33
addx -1
addx 2
noop
addx 26
addx -22
addx 19
addx -16
addx 8
addx -1
addx 3
addx -2
addx 2
addx -17
addx 24
addx 1
noop
addx 5
addx -1
noop
addx 5
noop
noop
addx 1
noop
noop