public static Person Random() { bool gender = MochaRandom.Bool(); return(new Person(People.NamingSystem.systems[0].RandomFromGender(gender), gender, Personality.Random(), Sexuality.Random())); }
public static Personality Random() { return(new Personality( Bio.Lifeform.lifeforms.Select(r => MochaRandom.Byte()).ToArray(), Resource.resources.Select(r => MochaRandom.Byte()).ToArray(), PersonalityAxis.axes.Select(a => MochaRandom.Byte()).ToArray() )); }
public static Sexuality Random() { return(new Sexuality( MochaRandom.Bool(), MochaRandom.Bool(), MochaRandom.Bool(), MochaRandom.Bool(), MochaRandom.Bool() )); }
public static void Initialize() { // choose 200 random tiles and put countries there... double meany = 0.5 * World.size; double stdy = 0.2 * World.size; // experimentation has shown this to look nicest for (int i = 0; i < maxCountries; i++) { WorldTile attempt; while (0 <= (attempt = Program.world.tiles // reassign every test [Program.Mod((int)MochaRandom.Normal(meany, stdy), World.size), Program.rng.Next(0, 2 * World.size)] // longitude random, latitude normally distributed ).owner) { } // redo if there's already an owner capitals[i] = attempt; } Program.Log(String.Format("{0} countries placed", maxCountries)); }
public override void ProcessKeyboard(SadConsole.Console console, Keyboard info, out bool handled) { handled = true; bool shift = info.IsKeyDown(Keys.LeftShift) || info.IsKeyDown(Keys.RightShift); // could move this to line 36 if (info.IsKeyPressed(Keys.X)){ if this is an issue if (Program.world != null) { // movement keys can use else ifs since they are contradictory if (info.IsKeyPressed(Keys.Left)) { Program.world.MoveCursor(-1, 0); } else if (info.IsKeyPressed(Keys.Right)) { Program.world.MoveCursor(1, 0); } if (info.IsKeyPressed(Keys.Up)) { Program.world.MoveCursor(0, -1); } else if (info.IsKeyPressed(Keys.Down)) { Program.world.MoveCursor(0, 1); } // when released, update the map if (info.IsKeyReleased(Keys.Left) || info.IsKeyReleased(Keys.Right) || info.IsKeyReleased(Keys.Up) || info.IsKeyReleased(Keys.Down) ) { new Task(() => { Program.world.RedrawTooltip(); }).Start(); } // ditto for zoom keys if (info.IsKeyPressed(Keys.OemPlus)) { Program.world.Zoom(1); } else if (info.IsKeyPressed(Keys.OemMinus)) { Program.world.Zoom(-1); } // other keys can be pressed simultaneously if (info.IsKeyPressed(Keys.E)) { Program.world.selection.Embark(); Program.Log("Embarked! (Not yet implemented...)"); } if (info.IsKeyPressed(Keys.R)) // debug { Program.Log(People.NamingSystem.systems [Program.rng.Next(0, People.NamingSystem.systems.Count)] .RandomFromGender(MochaRandom.Bool())); } if (info.IsKeyPressed(Keys.S)) // save map { new Task(() => { Export.Celestia.ExportBitmap(); }).Start(); } if (info.IsKeyPressed(Keys.X)) { Mapping.CycleChar(shift ? -1 : 1); Program.world.Print(); } if (info.IsKeyPressed(Keys.Z)) { Mapping.CycleColor(shift ? -1 : 1); Program.world.Print(); } } if (info.IsKeyPressed(Keys.Escape)) { Program.Exit(); } }
int RandomMass() { // normally distributed. return((int)MochaRandom.Normal(mass, standardDeviationAsAFactorOfMass * mass)); }