Code formatting and warning fixing.

This commit is contained in:
2024-12-01 17:36:23 +01:00
parent 9f8d966b7a
commit dafd2526d1
93 changed files with 739 additions and 823 deletions

View File

@@ -124,14 +124,14 @@ public class Day08 : IDay
return vm.Accumulator.ToString();
}
public enum OpCode
private enum OpCode
{
Acc,
Jmp,
Nop,
}
public class Instruction
private class Instruction
{
public OpCode OpCode { get; set; }
public int Value { get; set; }
@@ -154,14 +154,9 @@ public class Day08 : IDay
OpCode = OpCode.Nop;
}
if (parts[1].StartsWith("+"))
{
Value = Convert.ToInt32(parts[1].Substring(1));
}
else
{
Value = Convert.ToInt32(parts[1]);
}
Value = Convert.ToInt32(parts[1].StartsWith("+")
? parts[1].Substring(1)
: parts[1]);
Executed = false;
}
}
@@ -176,7 +171,7 @@ public class Day08 : IDay
public VM(string[] inputs)
{
Instructions = new List<Instruction>();
Instructions = [];
foreach (string input in inputs)
{
Instructions.Add(new Instruction(input));