Game/AwardPoints.cs
namespace BlockParty;
/// <summary>Shared medal/trophy standings policy. Individual run scores are unchanged.</summary>
public static class AwardPoints
{
public const string Ranking = "points_4_2_1_desc,gold_desc,silver_desc,bronze_desc";
public static long Total( int gold, int silver, int bronze ) => 4L * gold + 2L * silver + bronze;
public static string Tip( int place ) => place switch { 1 => "4 points", 2 => "2 points", 3 => "1 point", _ => null };
// Negative means the first player comes before the second in descending standings.
public static int Compare( int gold, int silver, int bronze, int otherGold, int otherSilver, int otherBronze )
{
int result = Total( otherGold, otherSilver, otherBronze ).CompareTo( Total( gold, silver, bronze ) );
if ( result == 0 ) result = otherGold.CompareTo( gold );
if ( result == 0 ) result = otherSilver.CompareTo( silver );
if ( result == 0 ) result = otherBronze.CompareTo( bronze );
return result;
}
}