59 lines
No EOL
1.7 KiB
C#
59 lines
No EOL
1.7 KiB
C#
namespace HorseRace;
|
|
|
|
public sealed class Horse
|
|
{
|
|
public Horse(string name, int age, int startNo)
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
public int Age { get; }
|
|
public string Name { get; }
|
|
public int Position { get; private set; }
|
|
public int Rank { get; set; }
|
|
public int StartNumber { get; }
|
|
|
|
/// <summary>
|
|
/// Compares this <see cref="Horse" />, first by position and then by start number,
|
|
/// to the supplied <see cref="Horse" />
|
|
/// </summary>
|
|
/// <param name="other"><see cref="Horse" /> to compare to</param>
|
|
/// <returns>The position difference between two horses</returns>
|
|
public int CompareTo(Horse other)
|
|
{
|
|
// TODO
|
|
return -1;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Draws the current position of this <see cref="Horse" /> to the console, including
|
|
/// its label and the finish line.
|
|
/// </summary>
|
|
public void Draw()
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
/// <summary>
|
|
/// Randomly either increases or keeps the position of the <see cref="Horse" />.
|
|
/// </summary>
|
|
public void Move()
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
/// <summary>
|
|
/// Attempts to parse a CSV formatted string to a <see cref="Horse" /> instance.
|
|
/// Also sets the supplied <see cref="startNo" /> if parsing succeeds.
|
|
/// </summary>
|
|
/// <param name="csvLine">Text to parse</param>
|
|
/// <param name="startNo">Start number to set; must not be negative</param>
|
|
/// <param name="horse">Set to the parsed instance; null if parsing fails</param>
|
|
/// <returns>True if parsed successfully; false otherwise</returns>
|
|
public static bool TryParse(string csvLine, int startNo, out Horse? horse)
|
|
{
|
|
// TODO
|
|
horse = null;
|
|
return false;
|
|
}
|
|
} |