parent
8f0b6f102c
commit
6a685af00c
@ -0,0 +1,46 @@ |
||||
using System; |
||||
|
||||
namespace Part2 { |
||||
public class calcInputs { |
||||
public void bruteforce( int[] input, int find ) { |
||||
int noun, verb; |
||||
int[] input_c = input; // keep a version of the original |
||||
int[] output = new int[input_c.Length]; |
||||
|
||||
bool success = false; |
||||
|
||||
int min = 0; // min and max for the input values |
||||
int max = 99; // |
||||
|
||||
Part1.compile compile = new Part1.compile(); |
||||
|
||||
for( int i = 0; i < max + 1; i++ ) { |
||||
input = input_c; // reset the intcode |
||||
|
||||
noun = Math.Clamp( i, min, max ); |
||||
verb = Math.Clamp( i, min, max ); |
||||
|
||||
input[1] = noun; |
||||
input[2] = verb; |
||||
|
||||
Console.WriteLine( "Checking: {0}, {1} for {2}", noun, verb, find ); |
||||
output = compile.intcode( input ); |
||||
|
||||
Console.WriteLine( input[0] ); |
||||
if( output[0] == find ) { |
||||
Console.WriteLine( "({0}) Found: {1}, {2}", find, noun, verb ); |
||||
success = true; |
||||
break; |
||||
} |
||||
|
||||
} |
||||
|
||||
Console.WriteLine(""); |
||||
|
||||
if( success == false ) { |
||||
Console.WriteLine( "Nothing found :(" ); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
} |
Binary file not shown.
Binary file not shown.
@ -1 +1 @@ |
||||
1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,10,19,1,19,6,23,2,23,13,27,1,27,5,31,2,31,10,35,1,9,35,39,1,39,9,43,2,9,43,47,1,5,47,51,2,13,51,55,1,55,9,59,2,6,59,63,1,63,5,67,1,10,67,71,1,71,10,75,2,75,13,79,2,79,13,83,1,5,83,87,1,87,6,91,2,91,13,95,1,5,95,99,1,99,2,103,1,103,6,0,99,2,14,0,0 |
||||
2,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
@ -1 +1 @@ |
||||
9fe783133b7f321bdac60ee865e123f6adce08e3 |
||||
f79d1ed33da9ca6da7e131988eb0964470e8edf6 |
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue