Making progress on initial functions
This commit is contained in:
parent
f6264d9098
commit
3d335d32c4
@ -11,12 +11,24 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
Network StartingState = null;
|
Network StartingState = null;
|
||||||
public List<NetworkAction> NetActions = new List<NetworkAction>();
|
public List<NetworkAction> NetActions = new List<NetworkAction>();
|
||||||
|
NetworkAction CurrentNetAction = null;
|
||||||
|
|
||||||
public void RegisterNet(Network starting)
|
public void RegisterNet(Network starting)
|
||||||
{
|
{
|
||||||
//Get name from network
|
CurrentNetAction = new NetworkAction(starting);
|
||||||
//See if that
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Add(ActionClass What)
|
||||||
|
{
|
||||||
|
if(CurrentNetAction == null)
|
||||||
|
{
|
||||||
|
Network start = NB.GetNetwork();
|
||||||
|
if (start == null) return;//Do nothing
|
||||||
|
CurrentNetAction = new NetworkAction(start);
|
||||||
|
}
|
||||||
|
CurrentNetAction.Add(What);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if we already have a solved state for this network
|
/// Return true if we already have a solved state for this network
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -25,23 +37,55 @@ namespace EduNetworkBuilder
|
|||||||
public bool AlreadyHaveNet(Network starting)
|
public bool AlreadyHaveNet(Network starting)
|
||||||
{
|
{
|
||||||
//Look up the network to see if we have it already
|
//Look up the network to see if we have it already
|
||||||
return AlreadyHaveNet(starting.PuzzleName);
|
return AlreadyHaveNet(NameFromNet(starting));
|
||||||
}
|
}
|
||||||
public bool AlreadyHaveNet(string starting)
|
public bool AlreadyHaveNet(string starting)
|
||||||
{
|
{
|
||||||
//Look up the network to see if we have it already
|
NetworkAction NA = GetActionlistFromName(starting);
|
||||||
foreach(NetworkAction NA in NetActions)
|
if (NA != null) return true; //one exists
|
||||||
{
|
|
||||||
if (NA.NetworkName == starting) return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public NetworkAction GetActionlistFromNet(Network starting)
|
||||||
|
{
|
||||||
|
return GetActionlistFromName(NameFromNet(starting));
|
||||||
|
}
|
||||||
|
public NetworkAction GetActionlistFromName(string starting)
|
||||||
|
{
|
||||||
|
foreach (NetworkAction NA in NetActions)
|
||||||
|
{
|
||||||
|
if (NA.NetworkName == starting) return NA;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private string NameFromNet(Network theNet)
|
||||||
|
{
|
||||||
|
return theNet.PuzzleName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NetworkAction
|
public class NetworkAction
|
||||||
{
|
{
|
||||||
public string NetworkName = "";
|
public string NetworkName = "";
|
||||||
public List<ActionClass> Actions = new List<ActionClass>();
|
public List<ActionClass> Actions = new List<ActionClass>();
|
||||||
|
public NetworkAction(string Name)
|
||||||
|
{
|
||||||
|
NetworkName = Name;
|
||||||
|
Actions.Clear();
|
||||||
|
}
|
||||||
|
public NetworkAction(Network Start)
|
||||||
|
{
|
||||||
|
if (Start == null)
|
||||||
|
Start = NB.GetNetwork();
|
||||||
|
if (Start != null)
|
||||||
|
NetworkName = Start.PuzzleName;
|
||||||
|
else
|
||||||
|
NetworkName = "Empty";
|
||||||
|
Actions.Clear();
|
||||||
|
}
|
||||||
|
public void Add(ActionClass What)
|
||||||
|
{
|
||||||
|
Actions.Add(What);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ActionClass
|
public class ActionClass
|
||||||
|
Loading…
Reference in New Issue
Block a user