Day 8 finished!!

This commit is contained in:
Steph 2022-12-01 21:02:00 +01:00
parent af970447ac
commit 9b92330123

View File

@ -62,8 +62,6 @@ static int DoTheThing(List<string> lines) {
// Halt when reaching HLT // Halt when reaching HLT
while(lines[i] != "hlt") { while(lines[i] != "hlt") {
if(i >= lines.Count) return acc;
var parts = lines[i].Split(" "); var parts = lines[i].Split(" ");
var instruction = parts[0]; var instruction = parts[0];
var intval = int.Parse(parts[1]); var intval = int.Parse(parts[1]);
@ -77,6 +75,8 @@ static int DoTheThing(List<string> lines) {
// Do the jump // Do the jump
if(instruction == "jmp") i += intval; if(instruction == "jmp") i += intval;
else i++; else i++;
if(i >= lines.Count) return acc;
} }
throw new Exception("Lmaoo this isn't it"); throw new Exception("Lmaoo this isn't it");