using System.Drawing; namespace Day18; public record Instruction(char Dir, int Num, byte[] Scramble) { private static readonly IDictionary DirMap = new Dictionary { [0] = 'R', [1] = 'D', [2] = 'L', [3] = 'U' }; public Instruction Unscramble() { var code = BitConverter.ToInt32(Scramble.Reverse().Append((byte)0).ToArray()); var dirIndex = code & 15; var num = code >> 4; return new Instruction(DirMap[dirIndex], num, new byte[] { }); } }