private void calc() { StringReader reader = new StringReader(textBox1.Text.Replace(" ", "").Replace("\t", "").Replace("\r", "").Replace("\n", "")); List <int> list = reader.ParseIntArray().ToList(); root = new NumberNode(list[0]); for (int i = 1; i < list.Count; i++) { root.Insert(list[i]); } root.SumToMax(0, (int)numericUpDown1.Value); string file = "lolTOURINGBILD" + new Random().Next() + ".jpg"; GraphPlotter.GraphPlott.PlottToFile(root.GetAll(), file, 1000, false); pictureBox1.Image = Image.FromFile(file); }
public int SumToMax(int current, int max) { if (Bigger != null) { current += Bigger.SumToMax(0, max - current); } if (Value <= max - current) { current += Value; NodeColor = Microsoft.Glee.Drawing.Color.Red; } if (Smaller != null) { current += Smaller.SumToMax(0, max - current); } return(current); }