public static GenerationResult Generate(FillingMethod fillingMethod, SeedOptions options) { var random = new Random(); Seed seed; var itterations = 0; var stopwatch = new Stopwatch(); stopwatch.Start(); do { itterations++; seed = Seed.GenerateRandom(options, random); } while (!IsBeatable(seed, fillingMethod)); stopwatch.Stop(); Console.Out.WriteLine($"Spend {itterations} itterations to generate seed {seed}, in {stopwatch.Elapsed}"); return(new GenerationResult { Seed = seed, Itterations = itterations, Elapsed = stopwatch.Elapsed }); }
public static ItemLocationMap Randomize(Seed seed, FillingMethod fillingMethod, GameSave saveGame, bool progressionOnly = false) { var unlockingMap = new ItemUnlockingMap(seed); var itemInfoProvider = new ItemInfoProvider(seed.Options, unlockingMap); ItemLocationRandomizer randomizer; switch (fillingMethod) { case FillingMethod.Forward: randomizer = new ForwardFillingItemLocationRandomizer(seed, itemInfoProvider, unlockingMap); break; case FillingMethod.Random: randomizer = new FullRandomItemLocationRandomizer(seed, itemInfoProvider, unlockingMap); break; case FillingMethod.Archipelago: randomizer = new ArchipelagoItemLocationRandomizer(seed, itemInfoProvider, unlockingMap, saveGame); break; default: throw new NotImplementedException($"filling method {fillingMethod} is not implemented"); } return(randomizer.GenerateItemLocationMap(progressionOnly)); }
/// <summary> /// Банка, содержащая ртуть и воду /// </summary> /// <param name="jarInstance">банка,</param> /// <param name="month">месяц,</param> /// <param name="year">год,</param> /// <param name="state">состояние на момент окончания месяца,</param> /// <param name="method">метод заливки,</param> /// <param name="mercuryProduction">добыча ртути,</param> /// <param name="waterProduction">добыча воды,</param> /// <param name="minutes">время заливки в минутах.</param> public JarHistory(Jar jarInstance, int month, int year, JarType type, JarState state, FillingMethod method, int mercuryProduction, int waterProduction, int minutes) : this(jarInstance,month,year,JarType.WaterMercury, state,method) { Method = method; Minutes = minutes; MercuryProduction = mercuryProduction; WaterProduction = waterProduction; }
public void SetSeedAndFillingMethod(Seed selectedSeed, FillingMethod choosenFillingMethod, SettingCollection selectedSettings) { seed = selectedSeed; fillingMethod = choosenFillingMethod; settings = selectedSettings; seedRepresentation.SetSeed(selectedSeed); SetSelectedMenuItemByIndex(2); EnableAllMenuItems(); }
//внешний ключ(при необходимости) //public int JarId { get; set; } /// <summary> /// Пустая или запланированная банка /// </summary> /// <param name="jarInstance">банка,</param> /// <param name="month">месяц,</param> /// <param name="year">год,</param> /// <param name="type">вид хранимого вещества,</param> /// <param name="state">состояние на момент окончания месяца,</param> /// <param name="method">метод заливки,</param> public JarHistory(Jar jarInstance, int month, int year, JarType type, JarState state, FillingMethod method=FillingMethod.NoFilling) { if (jarInstance == null) throw new Exception("Невозможно хранить состояние несуществующей банки"); else _jarInstance = jarInstance; Type = type; Month = month; Year = year; State = state; Method = method; }
public override void Update(GameTime gameTime, InputState input) { base.Update(gameTime, input); if (seed == null) { SetSelectedMenuItemByIndex(0); if (input.IsNewButtonPress(Buttons.LeftThumbstickLeft) || input.IsNewButtonPress(Buttons.LeftThumbstickRight) || input.IsNewButtonPress(Buttons.RightThumbstickLeft) || input.IsNewButtonPress(Buttons.RightThumbstickRight) || input.IsNewButtonPress(Buttons.DPadLeft) || input.IsNewButtonPress(Buttons.DPadRight) || input.IsNewButtonPress(Buttons.LeftTrigger) || input.IsNewButtonPress(Buttons.RightTrigger) || input.IsNewKeyPress(Keys.Left) || input.IsNewKeyPress(Keys.Right)) { if (fillingMethod == FillingMethod.Archipelago) { fillingMethod = FillingMethod.Random; } else { fillingMethod = FillingMethod.Archipelago; } } } if (fillingMethod == FillingMethod.Archipelago) { seedMenuEntry.Text = "<< Archipelago >>"; seedMenuEntry.Description = "Connect to an Archipelago Multiworld server"; } else if (seed == null) { seedMenuEntry.Text = "<< Choose seed >>"; seedMenuEntry.Description = "Select the seed used to generate the randomness"; } else { seedMenuEntry.Text = "Seed: "; seedMenuEntry.Description = "Select the seed used to generate the randomness"; } }
public GameDifficultyMenuScreen(ScreenManager screenManager, GameScreen screen) : base(screenManager, screen) { UpdateHardModeDifficulties(); if (ConnectCommand.IsWaitingForDifficulty) { fillingMethod = FillingMethod.Archipelago; } else { DisableDefaultDifficultOptions(); } seedMenuEntry = GetSelectSeedMenu(); AddMenuEntryAtIndex(0, seedMenuEntry); seedRepresentation = new SeedRepresentation(ScreenManager.Dynamic.GCM); HookOnDifficultySelectedMethod(); }
public static ItemLocationMap Randomize(Seed seed, FillingMethod fillingMethod, bool progressionOnly = false) { var unlockingMap = new ItemUnlockingMap(seed); var itemInfoProvider = new ItemInfoProvider(seed.Options, unlockingMap); var itemLocations = new ItemLocationMap(itemInfoProvider, unlockingMap, seed.Options); switch (fillingMethod) { case FillingMethod.Forward: ForwardFillingItemLocationRandomizer.AddRandomItemsToLocationMap(seed, itemInfoProvider, unlockingMap, itemLocations, progressionOnly); break; case FillingMethod.Random: FullRandomItemLocationRandomizer.AddRandomItemsToLocationMap(seed, itemInfoProvider, unlockingMap, itemLocations, progressionOnly); break; default: throw new NotImplementedException($"filling method {fillingMethod} is not implemented"); } return(itemLocations); }
public static bool IsBeatable(Seed seed, FillingMethod fillingMethod) => Randomize(seed, fillingMethod, null, true).IsBeatable();
internal static void SetFillingMethod(this GameSave gameSave, FillingMethod fillingMethod) => gameSave.DataKeyStrings[FillMethodSaveFileKey] = fillingMethod.ToString();
/// <summary> /// Банка, содержащая воду /// </summary> /// <param name="jarInstance">банка,</param> /// <param name="month">месяц,</param> /// <param name="year">год,</param> /// <param name="state">состояние на момент окончания месяца,</param> /// <param name="method">метод заливки,</param> /// <param name="waterLoading">добыча воды,</param> /// <param name="minutes">время заливки в минутах.</param> public JarHistory(Jar jarInstance, int month, int year, JarType type, JarState state, FillingMethod method, int waterLoading, int minutes) : this(jarInstance, month, year, JarType.WaterMercury, state,method) { Method = method; Minutes = minutes; WaterLoading = waterLoading; }