namespace Domain {
	public class Score {
		public int Value { private set; get; }

		public readonly int SpawnRate;
		public readonly int GrowIterations;

		public float GrowPercentage { private set; get; }

		public Score(int spawnRate, int growIterations) : this(0, spawnRate, growIterations) { }

		public Score(int value, int spawnRate, int growIterations) {
			Value = value;
			SpawnRate = spawnRate;
			GrowIterations = growIterations;
		}

		public void SetFromOtherScore(Score other) {
			Value = other.Value;
			UpdateGrowPercentage();
		}

		public void Add() {
			Value++;
			UpdateGrowPercentage();
		}

		private void UpdateGrowPercentage() {
			int value = Value % GrowIterations == 0 ? Value : Value / GrowIterations * GrowIterations;

			float relativeScore = value % (GrowIterations * SpawnRate);
			GrowPercentage = relativeScore / (SpawnRate * GrowIterations);
		}
	}
}