public static Degree getRandomHackerDegree(WorldLocation origin) { var degree = new Degree(); degree.name = randOf(degreeTitles) + randOf(hackerDegreeNames); degree.GPA = (float) (3.0 + 5.0*(Utils.random.NextDouble() - 0.5)*0.5); degree.uni = "University of " + origin.name; if (Utils.flipCoin()) degree.uni = origin.name + " University"; return degree; }
public static WorldLocation getClosestOrCreate(string name) { for (var index = 0; index < locations.Count; ++index) { if (locations[index].name.ToLower().Equals(name.ToLower())) return locations[index]; } var worldLocation = new WorldLocation(name, name, (float) Utils.random.NextDouble(), (float) Utils.random.NextDouble(), (float) Utils.random.NextDouble(), (float) Utils.random.NextDouble()); locations.Add(worldLocation); return worldLocation; }
public static Degree getRandomHackerDegree(WorldLocation origin) { Degree degree = new Degree(); degree.name = PeopleAssets.randOf(PeopleAssets.degreeTitles) + PeopleAssets.randOf(PeopleAssets.hackerDegreeNames); degree.GPA = (float)(3.0 + 5.0 * (Utils.random.NextDouble() - 0.5) * 0.5); degree.uni = "University of " + origin.name; if (Utils.flipCoin()) { degree.uni = origin.name + " University"; } return(degree); }
public static WorldLocation getClosestOrCreate(string name) { for (int index = 0; index < WorldLocationLoader.locations.Count; ++index) { if (WorldLocationLoader.locations[index].name.ToLower().Equals(name.ToLower())) { return(WorldLocationLoader.locations[index]); } } WorldLocation worldLocation = new WorldLocation(name, name, (float)Utils.random.NextDouble(), (float)Utils.random.NextDouble(), (float)Utils.random.NextDouble(), (float)Utils.random.NextDouble()); WorldLocationLoader.locations.Add(worldLocation); return(worldLocation); }
public MedicalRecord(WorldLocation location, DateTime dob) { DateofBirth = dob; var days = (DateTime.Now - dob).Days; var num1 = 155; var num2 = 220; Height = num1 + (int) (Utils.random.NextDouble()*Utils.random.NextDouble()*(num2 - num1)); AddRandomVists(days, location); BloodType = (Utils.flipCoin() ? 'A' : (Utils.flipCoin() ? 'B' : 'O')) + (Utils.flipCoin() ? 'A' : (Utils.flipCoin() ? 'B' : 'O')).ToString(); if (Allergants == null) LoadStatics(); AddAllergies(); }
private void AddRandomVists(int daysOld, WorldLocation loc) { int num1 = (int)(Utils.random.NextDouble() * Utils.random.NextDouble() * 10.0); int maxValue = daysOld / 2; int num2 = daysOld; int num3 = 0; for (int index = 0; index < num1; ++index) { int num4 = Utils.random.Next(1, maxValue); this.Visits.Add((this.DateofBirth + TimeSpan.FromDays((double)(num3 + num4) - Utils.random.NextDouble())).ToString() + " - " + (Utils.random.NextDouble() < 0.7 ? loc.name : loc.country) + (Utils.flipCoin() ? " Public" : " Private") + " Hospital"); num2 -= num4; num3 += num4; maxValue = (int)((double)num2 * 0.7); } }
public MedicalRecord(WorldLocation location, DateTime dob) { this.DateofBirth = dob; int days = (DateTime.Now - dob).Days; int num1 = 155; int num2 = 220; this.Height = num1 + (int)(Utils.random.NextDouble() * Utils.random.NextDouble() * (double)(num2 - num1)); this.AddRandomVists(days, location); this.BloodType = (Utils.flipCoin() ? (int)'A' : (Utils.flipCoin() ? (int)'B' : (int)'O')).ToString() + (object)(char)(Utils.flipCoin() ? (int)'A' : (Utils.flipCoin() ? (int)'B' : (int)'O')); if (MedicalRecord.Allergants == null) { this.LoadStatics(); } this.AddAllergies(); }
public MedicalRecord(WorldLocation location, DateTime dob) { DateofBirth = dob; var days = (DateTime.Now - dob).Days; var num1 = 155; var num2 = 220; Height = num1 + (int)(Utils.random.NextDouble() * Utils.random.NextDouble() * (num2 - num1)); AddRandomVists(days, location); BloodType = (Utils.flipCoin() ? 'A' : (Utils.flipCoin() ? 'B' : 'O')) + (Utils.flipCoin() ? 'A' : (Utils.flipCoin() ? 'B' : 'O')).ToString(); if (Allergants == null) { LoadStatics(); } AddAllergies(); }
private void AddRandomVists(int daysOld, WorldLocation loc) { var num1 = (int) (Utils.random.NextDouble()*Utils.random.NextDouble()*10.0); var maxValue = daysOld/2; var num2 = daysOld; var num3 = 0; for (var index = 0; index < num1; ++index) { var num4 = Utils.random.Next(1, maxValue); Visits.Add((DateofBirth + TimeSpan.FromDays(num3 + num4 - Utils.random.NextDouble())) + " - " + (Utils.random.NextDouble() < 0.7 ? loc.name : loc.country) + (Utils.flipCoin() ? " Public" : " Private") + " Hospital"); num2 -= num4; num3 += num4; maxValue = (int) (num2*0.7); } }
public static Degree getRandomDegree(WorldLocation origin) { var degree = new Degree(); degree.name = randOf(degreeTitles) + randOf(degreeNames); degree.GPA = (float)(3.0 + 3.0 * (Utils.random.NextDouble() - 0.5) * 0.5); while (degree.GPA > 4.0) { degree.GPA -= Utils.randm(0.4f); } degree.uni = "University of " + origin.name; if (Utils.flipCoin()) { degree.uni = origin.name + " University"; } return(degree); }
public static MedicalRecord Load(XmlReader rdr, WorldLocation location, DateTime dob) { var medicalRecord = new MedicalRecord(location, dob); while (rdr.Name != "Medical") { rdr.Read(); } rdr.Read(); while (!(rdr.Name == "Medical") || rdr.IsStartElement()) { if (rdr.IsStartElement()) { switch (rdr.Name) { case "Blood": medicalRecord.BloodType = rdr.ReadElementContentAsString(); break; case "Height": medicalRecord.Height = rdr.ReadElementContentAsInt(); break; case "Allergies": medicalRecord.Allergies.Clear(); medicalRecord.Allergies.AddRange(rdr.ReadElementContentAsString().Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)); break; case "Perscription": medicalRecord.Perscriptions.Add(rdr.ReadElementContentAsString()); break; case "Notes": medicalRecord.Notes = rdr.ReadElementContentAsString(); break; } } rdr.Read(); } return(medicalRecord); }
public Person(string fName, string lName, bool male, bool isHacker = false, string handle = null) { firstName = fName; lastName = lName; isMale = male; this.handle = handle; this.isHacker = isHacker; birthplace = WorldLocationLoader.getRandomLocation(); vehicles = new List<VehicleRegistration>(); degrees = new List<Degree>(); addRandomDegrees(); addRandomVehicles(); var num1 = 18; var num2 = 72; if (isHacker) num2 = 45; DateOfBirth = DateTime.Now - TimeSpan.FromDays(num1*365 + (int) (Utils.random.NextDouble()*(num2 - num1)*365.0)); medicalRecord = new MedicalRecord(birthplace, DateOfBirth); }
public Person(string fName, string lName, bool male, bool isHacker = false, string handle = null) { firstName = fName; lastName = lName; isMale = male; this.handle = handle; this.isHacker = isHacker; birthplace = WorldLocationLoader.getRandomLocation(); vehicles = new List <VehicleRegistration>(); degrees = new List <Degree>(); addRandomDegrees(); addRandomVehicles(); var num1 = 18; var num2 = 72; if (isHacker) { num2 = 45; } DateOfBirth = DateTime.Now - TimeSpan.FromDays(num1 * 365 + (int)(Utils.random.NextDouble() * (num2 - num1) * 365.0)); medicalRecord = new MedicalRecord(birthplace, DateOfBirth); }
public static MedicalRecord Load(XmlReader rdr, WorldLocation location, DateTime dob) { var medicalRecord = new MedicalRecord(location, dob); while (rdr.Name != "Medical") rdr.Read(); rdr.Read(); while (!(rdr.Name == "Medical") || rdr.IsStartElement()) { if (rdr.IsStartElement()) { switch (rdr.Name) { case "Blood": medicalRecord.BloodType = rdr.ReadElementContentAsString(); break; case "Height": medicalRecord.Height = rdr.ReadElementContentAsInt(); break; case "Allergies": medicalRecord.Allergies.Clear(); medicalRecord.Allergies.AddRange(rdr.ReadElementContentAsString().Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)); break; case "Perscription": medicalRecord.Perscriptions.Add(rdr.ReadElementContentAsString()); break; case "Notes": medicalRecord.Notes = rdr.ReadElementContentAsString(); break; } } rdr.Read(); } return medicalRecord; }