Ejemplo n.º 1
0
 public int CompareTurnsRemainingLT(Fleet fleet1, Fleet fleet2)
 {
     int result = (fleet1.TurnsRemaining() - fleet2.TurnsRemaining());
     if (result == 0) result = fleet1.NumShips() - fleet2.NumShips();
     if (result == 0) result = fleet1.SourcePlanet() - fleet2.SourcePlanet();
     if (result == 0) result = fleet1.DestinationPlanet() - fleet2.DestinationPlanet();
     return result;
 }
Ejemplo n.º 2
0
		//# Generates a string representation of a fleet. This is used to send data
		//# about the fleets to the client programs.
		public static string SerializeFleet(Fleet fleet)
		{
			int owner = fleet.Owner();
			string message = 
				"F " + 
				owner + 
				" " + 
				fleet.NumShips() + 
				" " +
				fleet.SourcePlanet() + 
				" " + 
				fleet.DestinationPlanet() + 
				" " +
				fleet.TotalTripLength() + 
				" " + 
				fleet.TurnsRemaining();
			return message.Replace(".0 ", " ");
		}