using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace ISXNodeGather { public partial class Form1 : Form { enum eState { running, paused }; eState _State = eState.paused; List _NodeList = new List(); public double WalkNodes(List nodes, Node curPos, double totalDistance) { if (nodes.Count == 1) { return curPos.Distance(nodes[0]) + totalDistance; } foreach (Node node in nodes) { WalkNodes(nodes.Remove(node), node, totalDistance + curPos.Distance(node)); } return 0; } public List BruteForcePath(List nodes, Node startPos) { List order = new List(); WalkNodes(nodes, startPos, 0); return order; } public Form1() { InitializeComponent(); UpdateUI(); } private void buttonStart_Click(object sender, EventArgs e) { if (_State == eState.running) { _State = eState.paused; } else { _State = eState.running; } UpdateUI(); } private void UpdateUI() { if (_State == eState.paused) buttonStart.Text = "Start"; else buttonStart.Text = "Pause"; } } }