In my console app i can get a perfect return but when i try to increment it in grasshopper it returns only nulls. So it might be a obvious answer but i’ve been trying to solve this for five days and i’m not familiar working without debug system. I can’t find where is the problem and why it is not giving me the output. I’m open to any suggestions or changes. Thanks.
If you want to try it out or make changes i'm adding code below;
int count = 0;
int maxval = 510;
var numbers = new List<int>() { 349, 349, 349, 349, 348, 348, 345, 345, 345, 330, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, 315, 315, 315, 315, 315, 314, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 299, 299, 299, 298, 298, 298, 298, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 280, 280, 280, 280, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 264, 264, 260, 260, 260, 260, 255, 255, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 225, 220, 220, 220, 220, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 199, 198, 190, 190, 190, 190, 190, 190, 190, 175, 175, 175, 175, 175, 175, 175, 175, 174, 174, 170, 170, 165, 165, 165, 165, 160, 160, 155, 155, 155, 155, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 149, 145, 145, 145, 145, 145, 145, 145, 140, 139, 139, 139, 139, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 115, 115, 115, 115, 115, 115, 115, 115, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 74, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 50, 50, 50, 24, 20, 20, 20, 20, 10, 5, 5, 5, 5, 5, 5, 5 };
for (int i = 0; i < numbers.Count; i++)
{
for (int j = 0; j < numbers.Count; j++)
{
if (numbers[j] < maxval - numbers[i] && numbers[j] + numbers[i] <= maxval)
{
numbers.RemoveAt(numbers.IndexOf(numbers[j]));
numbers.RemoveAt(i);
int z = numbers[j] + numbers[i];
bool test = true;
for (int t = 0; t < numbers.Count; t++)
{
if (numbers[t] < maxval - z && z + numbers[t] <= maxval)
{
count++;
Console.WriteLine("{0} + {1} + {2} = {3} 3 block piece used and block count is: {4} ", numbers[i], numbers[j], numbers[t], z + numbers[t], count);
numbers.RemoveAt(numbers.IndexOf(numbers[t]));
test = false;
Console.WriteLine("Total count is: {0}", count);
break;
}
}
if (test == true)
{
count++;
Console.WriteLine("{0} + {1} = {2} 2 block piece used and block count is: {3} ", numbers[i], numbers[j], z, count);
Console.WriteLine("Total count is: {0}", count);
}
}
}
}