public TimedMove(Move cpy, int time) : base(cpy) { this.time = time; }
public void ToString() { if (listOfLocations == null) { return; } PrintLine(); List <Move> currentMoves = new List <Move>(); for (int agentIndex = 0; agentIndex < listOfLocations.Count; agentIndex++) { currentMoves.Add(listOfLocations[agentIndex][0]); } string[] columns = new string[listOfLocations.Count + 1]; columns[0] = ""; for (int agentIndex = 1; agentIndex < listOfLocations.Count + 1; agentIndex++) { columns[agentIndex] = (agentIndex - 1).ToString(); } PrintRow(columns); PrintLine(); int maxTime = 0; foreach (List <Move> agentPath in listOfLocations) { if (agentPath.Count > maxTime) { maxTime = agentPath.Count; } } for (int time = 0; time < maxTime; time++) { columns = new string[listOfLocations.Count + 1]; columns[0] = time.ToString(); for (int i = 0; i < currentMoves.Count; i++) { Move currentMove = currentMoves[i]; if (currentMove != null) { columns[i + 1] = currentMove.x + "," + currentMove.y; } else { columns[i + 1] = " "; } } PrintRow(columns); for (int agentIndex = 0; time != maxTime - 1 && agentIndex < listOfLocations.Count; agentIndex++) { if (listOfLocations[agentIndex].Count > time + 1) { currentMoves[agentIndex] = listOfLocations[agentIndex][time + 1]; } else { currentMoves[agentIndex] = null; } } } PrintLine(); }
/// <summary> /// Isn't used anywhere /// </summary> /// <param name="cpy"></param> /// <param name="time"></param> public void setup(Move cpy, int time) { base.setup(cpy); this.time = time; }