Core/ScoreRules.cs

Static helper that defines scoring for apples in the game. It exposes ApplePoints(appleNumber, rules) which currently returns the ApplePoints value from the provided GameRules.

namespace Coilgarden;

/// <summary>
/// What an apple is worth. Pure maths, kept apart from the snake so scoring can be
/// reshaped in the difficulty phase without touching anything that decides where the snake
/// is.
/// </summary>
public static class ScoreRules
{
	/// <summary>
	/// Points for the nth apple of a run, counting from one.
	/// <para>
	/// Flat for now, and it takes the rules rather than reading configuration statically so
	/// that a run's scoring travels with the run. It is a function rather than a constant
	/// because the difficulty and pacing phase will almost certainly want it to grow with
	/// <paramref name="appleNumber"/>, and every caller already going through here means
	/// that becomes a one-line change instead of a hunt.
	/// </para>
	/// </summary>
	public static int ApplePoints( int appleNumber, GameRules rules ) => rules.ApplePoints;
}