static void Main(string[] args) { var rant = new RantEngine(); rant.LoadPackage("Stadtzeug-1.0.0.rantpkg"); rant.Dictionary.IncludeHiddenClass("nsfw"); var city = new City(9001, rant); Console.WriteLine($"{city.Name}, {city.CurrentTime}\n"); for (int i = 0; i < 45; i++) { var crime = rant.DoPackaged("sz/crime/conduct"); Console.WriteLine($"{crime} (severity: {crime["severity"]})"); } Console.ReadKey(); }
public Citizen(City city, long seed) { if (city == null) throw new ArgumentNullException(nameof(city)); _city = city; _seed = seed; _rng = new RNG(RNG.GetRaw(CITIZEN_RNG_BASE_GEN, seed)); var sdata = city.Rant.DoPackaged("sz/citizen", _seed); FirstName = String.Intern(sdata["firstname"]); MiddleName = String.Intern(sdata["middlename"]); MiddleInitial = MiddleName.FirstOrDefault(Char.IsLetter); LastName = String.Intern(sdata["lastname"]); Enum.TryParse(sdata["sex"], true, out _sex); // Tilt the distribution towards younger people var age = _rng.Next(18, _rng.Next(30, _rng.Next(30, 100))); var birthMonth = _rng.Next(12) + 1; var birthDay = _rng.Next(DateTime.DaysInMonth(city.StartingTime.Year - age, birthMonth)) + 1; BirthDate = new DateTime(city.StartingTime.Year - age, birthMonth, birthDay, 0, 0, 0); }