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
Tony Bark 8dcefdded0 Allocate from a budget of 25
- Newly generated algorithm thanks to GPT
- Somehow I thought the budget was 50
2025-04-27 06:10:00 -04:00

46 lines
1.4 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
string[] personalities = { "Outgoing", "Nice", "Playful", "Neat", "Active" };
// Function to randomly allocate points
void AllocatePoints()
{
int remainingPoints = totalPoints;
// First, allocate points to each personality.
for (int i = 0; i < points.Length; i++)
{
points[i] = rng.Next(0, 11); // Assign 0-10 points to each personality
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
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();