Archived.
This commit is contained in:
parent
5f404ecbd1
commit
2c574a57d5
2 changed files with 97 additions and 76 deletions
26
README.md
26
README.md
|
@ -2,6 +2,8 @@
|
|||
|
||||
As the name suggests, this will generate a personality for The Sims 2. If you choose to have a bias towards one trait being higher over the others, it will automatically compensate for the difference. It is recommended to only set a bias towards one trait at a time.
|
||||
|
||||
This has been succeeded by [PersonaForge](https://git.tonybark.com/tonytins/PersonaForge).
|
||||
|
||||
## 🛠 Features
|
||||
|
||||
* [x] User Input and Name Bias
|
||||
|
@ -10,30 +12,12 @@ As the name suggests, this will generate a personality for The Sims 2. If you ch
|
|||
* [ ] Dynamic Personality Range
|
||||
* [ ] CLI Arguments
|
||||
|
||||
## 🗓️ Support & Update Cycle
|
||||
## 🛡️ Status
|
||||
|
||||
| Type | Frequency | Notes |
|
||||
| ------------ | ---------------- | ---------------------------------------- |
|
||||
| Minor Update | Every 3–6 months | Small enhancements, non-breaking changes |
|
||||
| Patch Update | As needed | Bug fixes, security updates |
|
||||
| Major Update | As needed | Framework upgrades, major refactors |
|
||||
|
||||
* Reserve months: June (Mid-Year Chill) & December (End-Year Freeze)
|
||||
|
||||
## 🧘 Sustainability Practices
|
||||
|
||||
* 20% creative/recovery space built into development
|
||||
* Mandatory cooldowns after major launches (minimum 1 week)
|
||||
* Crisis Mode Activates if:
|
||||
* Critical vulnerabilities
|
||||
* Framework-breaking issues
|
||||
|
||||
## 🛡️ Support
|
||||
|
||||
* [x] Active Support
|
||||
* [ ] Active Support
|
||||
* [ ] Limited Support (Security patches only)
|
||||
* [ ] Maintenance Mode (Dependency-only updates)
|
||||
* [ ] Archived (No active work planned)
|
||||
* [x] Archived (No active work planned)
|
||||
|
||||
## 📓 Project Notes
|
||||
|
||||
|
|
|
@ -1,64 +1,101 @@
|
|||
var rng = new Random();
|
||||
using PersonalityGenerator;
|
||||
|
||||
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" };
|
||||
var isFinishedSession = false;
|
||||
|
||||
string GetUserInput(string prompt)
|
||||
void GenerateTraits()
|
||||
{
|
||||
Console.Write(prompt);
|
||||
return Console.ReadLine();
|
||||
}
|
||||
// Prompt the user to enter traits they want to prioritize.
|
||||
Console.WriteLine("You can prioritize one or more traits to be above 8 by entering them.");
|
||||
Console.Write("Enter traits separated by commas (e.g., Outgoing, Nice), or press Enter to generate a random personality: ");
|
||||
|
||||
// Function to randomly allocate points
|
||||
void AllocatePoints()
|
||||
{
|
||||
int remainingPoints = totalPoints;
|
||||
int biasIndex = Array.IndexOf(personalities, bias);
|
||||
// Read the user input and trim any leading or trailing whitespace.
|
||||
var prioritizedTraitsInput = Console.ReadLine()?.Trim();
|
||||
|
||||
// First, allocate points to each personality.
|
||||
for (int i = 0; i < points.Length; i++)
|
||||
// Initialize a dictionary with predefined traits and their initial values set to 0.
|
||||
var traits = new Dictionary<string, int>
|
||||
{
|
||||
if (i == biasIndex)
|
||||
{ "Outgoing", 0 },
|
||||
{ "Nice", 0 },
|
||||
{ "Playful", 0 },
|
||||
{ "Neat", 0 },
|
||||
{ "Active", 0 }
|
||||
};
|
||||
|
||||
// Process the prioritized traits input:
|
||||
// 1. Split the input string by commas.
|
||||
// 2. Trim whitespace from each resulting trait.
|
||||
// 3. Filter out any empty or invalid traits (traits that are not in the predefined list).
|
||||
var prioritizedTraits = new HashSet<string>(prioritizedTraitsInput.Split(',')
|
||||
.Select(t => t.Trim()).Where(t => !string.IsNullOrEmpty(t) && traits.ContainsKey(t)));
|
||||
|
||||
// Check if there are any prioritized traits provided by the user.
|
||||
if (prioritizedTraits.Count > 0)
|
||||
{
|
||||
points[i] = rng.Next(4, 11); // Assign 0-10 points to each personality
|
||||
// Assign values to the prioritized traits.
|
||||
TraitGenerator.AssignPrioritizedTraits(traits, prioritizedTraits);
|
||||
}
|
||||
else
|
||||
{
|
||||
points[i] = rng.Next(0, 6);
|
||||
// If no prioritized traits are provided, assign random values to all traits.
|
||||
TraitGenerator.AssignRandomTraits(traits);
|
||||
}
|
||||
|
||||
remainingPoints -= points[i];
|
||||
// Display the generated personality traits.
|
||||
TraitGenerator.DisplayPersonality(traits);
|
||||
|
||||
// Mark the session as finished.
|
||||
isFinishedSession = true;
|
||||
|
||||
// Re-enter the session manager to allow for another session or to exit.
|
||||
SessionManager();
|
||||
}
|
||||
|
||||
// Adjust the remaining points
|
||||
for (int i = 0; i < points.Length; i++)
|
||||
// Retrieves user input from the console with a given prompt.
|
||||
string? GetUserInput(string prompt)
|
||||
{
|
||||
if (remainingPoints == 0) break;
|
||||
Console.WriteLine(prompt);
|
||||
var input = Console.ReadLine();
|
||||
|
||||
int adjustment = Math.Min(rng.Next(0, 3), remainingPoints); // Small adjustment within range
|
||||
points[i] += adjustment;
|
||||
remainingPoints -= adjustment;
|
||||
return input;
|
||||
}
|
||||
|
||||
if (points[i] > 10) // Ensure no personality gets more than 10 points
|
||||
// Manages the personality generator session. It checks if a previous session is finished
|
||||
// and prompts the user to either generate a new personality or exit the application.
|
||||
void SessionManager()
|
||||
{
|
||||
int excess = points[i] - 10;
|
||||
points[i] = 10;
|
||||
remainingPoints += excess; // Return excess points to the pool
|
||||
}
|
||||
}
|
||||
// Greet the user at the start of a new session only if the previous session wasn't finished.
|
||||
if (!isFinishedSession)
|
||||
Console.WriteLine("Welcome to the Sim Personality Generator!");
|
||||
|
||||
// Print the final personality points
|
||||
Console.WriteLine($"{name}'s Personality Points:");
|
||||
for (int i = 0; i < points.Length; i++)
|
||||
// Define a message to prompt the user about generating a personality.
|
||||
// The message differs slightly if a previous session was already finished.
|
||||
var message = "Would you like to generate a random personality? [y/n]";
|
||||
if (isFinishedSession)
|
||||
message = "Would you like to generate a new personality? [y/n]";
|
||||
|
||||
// Retrieve the user's input through a prompt specified by 'message'.
|
||||
var input = GetUserInput(message);
|
||||
|
||||
// Convert the input to lowercase to handle user input in a case-insensitive manner.
|
||||
switch (input?.ToLower())
|
||||
{
|
||||
Console.WriteLine($"{personalities[i]}: {points[i]} points");
|
||||
case "y":
|
||||
// Reset the session status if the previous session was finished.
|
||||
if (isFinishedSession)
|
||||
isFinishedSession = false;
|
||||
|
||||
// Clear the console to provide a clean interface for generating a new personality.
|
||||
Console.Clear();
|
||||
|
||||
// Generate a new set of personality traits
|
||||
GenerateTraits();
|
||||
break;
|
||||
|
||||
default:
|
||||
// If the user enters anything other than 'y', terminate the application gracefully.
|
||||
Environment.Exit(Environment.ExitCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine($"Total remaining points in the pool: {remainingPoints}");
|
||||
}
|
||||
|
||||
// Generate the points and print the result
|
||||
AllocatePoints();
|
||||
SessionManager();
|
||||
|
|
Reference in a new issue