grab 5 choices & sort them

This commit is contained in:
Tim Young 2017-08-25 17:03:06 -05:00
parent e2b4d34e35
commit 4b695db457
2 changed files with 27 additions and 2 deletions

View File

@ -2150,8 +2150,32 @@ namespace EduNetworkBuilder
//we will prompt for stuff. For now, just use the firewalls network
LoadSolvedResource( SolvedNetworkNames.firewalls.ToString());
myNetwork.NonVisualDoDHCPOnAll();
TraversalClass tc = myNetwork.NonVisualPingOneHost("pc1", "pc2");
tc.DumpPath();
List<TraversalClass> TraversalCollection = new List<TraversalClass>();
//Choose five items to do
List<string> Devices = NB.Randomize<string>(myNetwork.GetHostnames());
int count = 0;
while (Devices.Count > 2 && count < 5)
{
TraversalClass tc = myNetwork.NonVisualPingOneHost(Devices[0], Devices[1]);
if(tc != null)
TraversalCollection.Add(tc);
else
{
Console.WriteLine("null generated by " + Devices[0] + " - " + Devices[1]);
}
Devices.RemoveAt(1);
Devices.RemoveAt(0);
count++;
}
TraversalCollection.Sort((a, b) => b.Count.CompareTo(a.Count));
for(int i=0; i< TraversalCollection.Count; i++)
{
Console.WriteLine(i + " " + TraversalCollection[i].Source());
Console.WriteLine(i + " " + TraversalCollection[i].Destination());
}
}
#endregion Random Map Stuff
}

View File

@ -21,6 +21,7 @@ namespace EduNetworkBuilder
}
List<TraversalRecord> PathTaken = new List<TraversalRecord>();
public int Count { get { return PathTaken.Count; } }
public TraversalClass(){ }