Personality Archetypes
Swapped old code (was an AI-generated template, anyway) for the new PersonalityGen-based one.
This commit is contained in:
parent
83784d2c00
commit
eeb30cf67d
3 changed files with 40 additions and 56 deletions
36
PersonalityArchetype.cs
Normal file
36
PersonalityArchetype.cs
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
namespace PersonaForge;
|
||||||
|
|
||||||
|
public class PersonalityArchetype
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public Dictionary<string, double> TraitBiases { get; set; } = new();
|
||||||
|
|
||||||
|
// TODO: Load default archetypes from a file or database
|
||||||
|
public static List<PersonalityArchetype> DefaultArchetypes() => new()
|
||||||
|
{
|
||||||
|
new PersonalityArchetype
|
||||||
|
{
|
||||||
|
Name = "Grumpy",
|
||||||
|
TraitBiases = new Dictionary<string, double>
|
||||||
|
{
|
||||||
|
{ "Nice", 0.2 },
|
||||||
|
{ "Playful", 0.4 },
|
||||||
|
{ "Outgoing", 0.6 },
|
||||||
|
{ "Neat", 0.7 },
|
||||||
|
{ "Active", 0.5 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new PersonalityArchetype
|
||||||
|
{
|
||||||
|
Name = "Party Animal",
|
||||||
|
TraitBiases = new Dictionary<string, double>
|
||||||
|
{
|
||||||
|
{ "Outgoing", 0.9 },
|
||||||
|
{ "Playful", 0.8 },
|
||||||
|
{ "Active", 0.7 },
|
||||||
|
{ "Nice", 0.5 },
|
||||||
|
{ "Neat", 0.3 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ public static class PersonalityGen
|
||||||
const int TotalBudget = 25;
|
const int TotalBudget = 25;
|
||||||
static readonly Random rng = new();
|
static readonly Random rng = new();
|
||||||
|
|
||||||
public static PersonalityProfile GeneratePersonalityProfile()
|
public static PersonalityProfile GenerateRandom()
|
||||||
{
|
{
|
||||||
var profile = PersonalityProfile.Create();
|
var profile = PersonalityProfile.Create();
|
||||||
var traits = new List<string> { "Outgoing", "Nice", "Playful", "Neat", "Active" };
|
var traits = new List<string> { "Outgoing", "Nice", "Playful", "Neat", "Active" };
|
||||||
|
|
58
Program.cs
58
Program.cs
|
@ -1,59 +1,7 @@
|
||||||
// .NET 8 C# - Random Sims 2 Personality Allocator
|
// .NET 8 C# - Random Sims 2 Personality Allocator
|
||||||
// Clear, minimal, portable, with basic validation.
|
// Clear, minimal, portable, with basic validation.
|
||||||
|
|
||||||
var totalPoints = 25;
|
using PersonaForge;
|
||||||
const int MaxPointsPerTrait = 10;
|
|
||||||
string[] traits = ["Outgoing", "Nice", "Playful", "Neat", "Active"];
|
|
||||||
Dictionary<string, int> personality = new();
|
|
||||||
Random rng = new();
|
|
||||||
|
|
||||||
// Shuffle traits to prevent boring patterns
|
var profile = PersonalityGen.GenerateRandom();
|
||||||
traits = traits.OrderBy(_ => rng.Next()).ToArray();
|
Console.WriteLine(profile.ToJson());
|
||||||
|
|
||||||
// Initialize
|
|
||||||
foreach (var trait in traits)
|
|
||||||
{
|
|
||||||
personality[trait] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign points while respecting max constraints
|
|
||||||
while (totalPoints > 0)
|
|
||||||
{
|
|
||||||
var availableTraits = new List<string>();
|
|
||||||
|
|
||||||
foreach (var trait in traits)
|
|
||||||
{
|
|
||||||
if (personality[trait] < MaxPointsPerTrait)
|
|
||||||
availableTraits.Add(trait);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (availableTraits.Count == 0)
|
|
||||||
{
|
|
||||||
// No available traits left to increment - something's off
|
|
||||||
Console.WriteLine("Warning: No traits available to increment.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var selectedTrait = availableTraits[rng.Next(availableTraits.Count)];
|
|
||||||
|
|
||||||
// "Extremes" are rare: only allow adding 1 point usually, maybe 2 points if random chance
|
|
||||||
var pointsToAdd = (rng.NextDouble() < 0.1) ? Math.Min(2, MaxPointsPerTrait - personality[selectedTrait]) : 1;
|
|
||||||
pointsToAdd = Math.Min(pointsToAdd, totalPoints);
|
|
||||||
|
|
||||||
personality[selectedTrait] += pointsToAdd;
|
|
||||||
totalPoints -= pointsToAdd;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display results
|
|
||||||
Console.WriteLine("=== Sims 2 Personality Points ===");
|
|
||||||
foreach (var kvp in personality)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"{kvp.Key}: {kvp.Value}");
|
|
||||||
}
|
|
||||||
Console.WriteLine($"Remaining Budget (should be 0): {totalPoints}");
|
|
||||||
|
|
||||||
// Safety check
|
|
||||||
if (totalPoints != 0)
|
|
||||||
{
|
|
||||||
Console.WriteLine("⚠️ Budget mismatch detected! Something funky happened.");
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue