diff --git a/Sim.cs b/Sim.cs index efa1cfc..2d9466f 100644 --- a/Sim.cs +++ b/Sim.cs @@ -1,10 +1,25 @@ namespace SimsPersonalityGenerator; -static class Sim +/// +/// Represents the Sim personality generator with methods to assign traits and display personality. +/// +internal static class Sim { + /// + /// The target value for prioritized traits to aim for, typically 8. + /// private const int Target = 8; - private static readonly Random Random = new Random(); - + + /// + /// A random number generator instance for generating random values. + /// + private static readonly Random Rand = new Random(); + + /// + /// Assigns high values to the specified prioritized traits and random values to other traits. + /// + /// A dictionary of traits with their initial values. + /// A set of traits that the user wants to prioritize. public static void AssignPrioritizedTraits(Dictionary traits, HashSet prioritizedTraits) { Console.WriteLine("Assigning high values to prioritized traits..."); @@ -13,7 +28,7 @@ static class Sim // Assign high values to prioritized traits (8, 9, or 10) foreach (var trait in prioritizedTraits) { - var value = Math.Min(Target + Random.Next(3), 10); + var value = Math.Min(Target + Rand.Next(3), 10); remainingPoints -= value; traits[trait] = value; Console.WriteLine($"Setting {trait} to {value}."); @@ -24,7 +39,7 @@ static class Sim foreach (var trait in nonPrioritizedTraits) { var maxPossibleValue = Math.Min(remainingPoints, 10); - var value = Random.Next(maxPossibleValue + 1); + var value = Rand.Next(maxPossibleValue + 1); remainingPoints -= value; traits[trait] = value; Console.WriteLine($"Setting {trait} to {value}."); @@ -33,6 +48,10 @@ static class Sim Console.WriteLine("Adjusted remaining traits to maintain balance."); } + /// + /// Assigns random values to all traits. + /// + /// A dictionary of traits with their initial values. public static void AssignRandomTraits(Dictionary traits) { Console.WriteLine("Generating random personality..."); @@ -41,7 +60,7 @@ static class Sim foreach (var trait in traits.Keys) { var maxPossibleValue = Math.Min(remainingPoints, 10); - var value = Random.Next(maxPossibleValue + 1); + var value = Rand.Next(maxPossibleValue + 1); remainingPoints -= value; traits[trait] = value; Console.WriteLine($"Setting {trait} to {value}."); @@ -50,6 +69,10 @@ static class Sim Console.WriteLine("Random personality generation complete."); } + /// + /// Displays the generated personality traits. + /// + /// A dictionary of traits with their assigned values. public static void DisplayPersonality(Dictionary traits) { Console.WriteLine("\nGenerated Sim Personality:");