This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
SimsPersonalityGenerator/SimPersonalityGenerator/Program.cs

64 lines
1.9 KiB
C#

var rng = new Random();
int totalPoints = 25;
int[] points = new int[5]; // To store the personality points for Outgoing, Nice, Playful, Neat, and Active
var name = GetUserInput("Enter the name of the Sim: ");
var bias = GetUserInput("Choose a personality bias (Outgoing, Nice, Playful, Neat, Active): ");
string[] personalities = { "Outgoing", "Nice", "Playful", "Neat", "Active" };
string GetUserInput(string prompt)
{
Console.Write(prompt);
return Console.ReadLine();
}
// Function to randomly allocate points
void AllocatePoints()
{
int remainingPoints = totalPoints;
int biasIndex = Array.IndexOf(personalities, bias);
// First, allocate points to each personality.
for (int i = 0; i < points.Length; i++)
{
if (i == biasIndex)
{
points[i] = rng.Next(4, 11); // Assign 0-10 points to each personality
}
else
{
points[i] = rng.Next(0, 6);
}
remainingPoints -= points[i];
}
// Adjust the remaining points
for (int i = 0; i < points.Length; i++)
{
if (remainingPoints == 0) break;
int adjustment = Math.Min(rng.Next(0, 3), remainingPoints); // Small adjustment within range
points[i] += adjustment;
remainingPoints -= adjustment;
if (points[i] > 10) // Ensure no personality gets more than 10 points
{
int excess = points[i] - 10;
points[i] = 10;
remainingPoints += excess; // Return excess points to the pool
}
}
// Print the final personality points
Console.WriteLine($"{name}'s Personality Points:");
for (int i = 0; i < points.Length; i++)
{
Console.WriteLine($"{personalities[i]}: {points[i]} points");
}
Console.WriteLine($"Total remaining points in the pool: {remainingPoints}");
}
// Generate the points and print the result
AllocatePoints();