Skip to content

Instantly share code, notes, and snippets.

@markhc
Last active December 7, 2019 15:43
Show Gist options
  • Save markhc/abe13d6a6e84b134bb17705fa6811326 to your computer and use it in GitHub Desktop.
Save markhc/abe13d6a6e84b134bb17705fa6811326 to your computer and use it in GitHub Desktop.
var phaseSetting = new int[] { 0, 1, 2, 3, 4 };
var maxThrusters = UInt64.MinValue;
do {
var vms = phaseSetting
.Select(x => new Intcode((int[])memory.Clone(), x.ToString()))
.ToArray();
var signal = "0";
while (!vms.Last().HasFinished) {
foreach (var vm in vms) {
signal = vm.Run(signal);
}
}
maxThrusters = Math.Max(UInt64.Parse(signal), maxThrusters);
} while (Permutations.NextPermutation(phaseSetting));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment