private GameCollection InitGameCollection(DifficultyLevels level) { GameCollection collection = new GameCollection(level); // Instantiate a new game collection class collection.GameManagerEvent += GameManagerEventHandler; // Set the event handler return(collection); // Return the pointer }
/// <summary> /// Liefert eine neue Instanz des Design View Models /// </summary> public DifficultyLevelManagementDesignViewModel() { DifficultyLevels.Add(new ItemWIthNameAndScoreDesignViewModel()); DifficultyLevels.Add(new ItemWIthNameAndScoreDesignViewModel()); SelectedDifficultyLevel = DifficultyLevels.First(); }
public AI(BoardPosition[,,] grid, int dim, DifficultyLevels dif) { gameMatrix = grid; dimension = dim; difficulty = dif; InitializeDifficultyParameters(); }
private void btnCreate_Click(object sender, RoutedEventArgs e) { Slider slMoney = UIHelpers.FindChild <Slider>(this, "money"); Slider slLoan = UIHelpers.FindChild <Slider>(this, "loan"); Slider slPrice = UIHelpers.FindChild <Slider>(this, "price"); Slider slPassengers = UIHelpers.FindChild <Slider>(this, "passengers"); Slider slAI = UIHelpers.FindChild <Slider>(this, "AI"); Slider slStartData = UIHelpers.FindChild <Slider>(this, "startdata"); double money = slMoney.Value; double loan = slLoan.Value; double passengers = slPassengers.Value; double price = slPrice.Value; double AI = slAI.Value; double startData = slStartData.Value; DifficultyLevel level = new DifficultyLevel("Custom", money, loan, passengers, price, AI, startData); WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2406"), Translator.GetInstance().GetString("MessageBox", "2406", "message"), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { DifficultyLevels.AddDifficultyLevel(level); PageNavigator.NavigateTo(new PageNewGame()); } }
public PageStartData() { InitializeComponent(); Continent continentAll = new Continent("100", "All continents"); cbContinent.Items.Add(continentAll); foreach (Continent continent in Continents.GetContinents()) { cbContinent.Items.Add(continent); } foreach (Region region in Regions.GetAllRegions()) { cbRegion.Items.Add(region); } for (int i = 1960; i < 2014; i++) { cbYear.Items.Insert(0, i); } cbYear.SelectedIndex = 0; cbDifficulty.ItemsSource = DifficultyLevels.GetDifficultyLevels(); foreach (Airline.AirlineFocus focus in Enum.GetValues(typeof(Airline.AirlineFocus))) { cbFocus.Items.Add(focus); } }
private static Int32 GetMaskedValue(DifficultyLevels level) { Int32 min; Int32 max; switch (level) { case DifficultyLevels.VeryEasy: // If the difficulty level is very easy min = 50; // Number of given is between 50 and 60 max = 60; break; case DifficultyLevels.Easy: // If the difficulty level is easy min = 36; // Number of given is between 36 and 49 max = 49; break; case DifficultyLevels.Medium: // If the difficulty level is medium min = 32; // Number of given is between 32 and 35 max = 35; break; case DifficultyLevels.Hard: // If the difficulty level is hard min = 28; // Number of given is between 28 and 31 max = 31; break; default: // Default is expert level. min = 22; // Number of given is between 22 and 27 max = 27; break; } return(RandomClass.GetRandomInt(min, max)); // Return a random number between the min and max }
internal MinesweeperModel(DifficultyLevels difficulty) { Difficulty = difficulty; switch (Difficulty) { case DifficultyLevels.EASY: Rows = 8; Cols = 10; NumOfBombs = 10; break; case DifficultyLevels.MEDIUM: Rows = 14; Cols = 18; NumOfBombs = 40; break; case DifficultyLevels.HARD: Rows = 20; Cols = 24; NumOfBombs = 99; break; } grid = new Cell[Rows, Cols]; NumOfFlags = NumOfBombs; }
public GameSettings(DifficultyLevels customLevel, int width, int height, int minesTotal) { DifficultyLevel = customLevel; FieldWidth = width; FieldHeight = height; FieldMinesTotal = minesTotal; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void openToolStripMenuItem_Click(object sender, EventArgs e) { Reset(); // OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Load Source Game Save"; ofd.Filter = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*"; ofd.InitialDirectory = localSaveGamePath; DialogResult dr = ofd.ShowDialog(); if (dr == DialogResult.Cancel) { return; } sourceSaveFile = ofd.FileName; sourceSavePath = Path.GetDirectoryName(sourceSaveFile); sourceSave = SaveData.Load(ofd.FileName); PopulateCharacters(sourceSave, ref sourcePCs, ref sourceRosterPCs, ref srcPcListView); // ofd = new OpenFileDialog(); ofd.Title = "Load Destination Game Save"; ofd.Filter = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*"; ofd.InitialDirectory = localSaveGamePath; dr = ofd.ShowDialog(); if (dr == DialogResult.Cancel) { newGameToolStripMenuItem.Enabled = true; destSavePath = localSaveGamePath; destSaveFile = null; return; } destSaveFile = ofd.FileName; destSavePath = Path.GetDirectoryName(destSaveFile); if (destSaveFile == sourceSaveFile) { MessageBox.Show("Cannot open the source as the destination save!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); Reset(); return; } destSave = SaveData.Load(ofd.FileName); PopulateCharacters(destSave, ref destPCs, ref destRosterPCs, ref dstPcListView); currentDifficulty = (DifficultyLevels)Convert.ToInt32(destSave["difficulty"].Value); difficultyComboBox.SelectedIndex = (int)currentDifficulty; selectReplacementButton.Enabled = true; clearReplacementButton.Enabled = true; }
private string GetGameCount(DifficultyLevels level) { if (_games == null) // Game manager class instantiated? { return("0"); // No, then just return zero } return(_games.GameCount(level).ToString()); // Yes, then return the actual game count }
public GameBoard(DifficultyLevels difficulty) { this.GameId = Guid.NewGuid(); this.gameLevel = difficulty; this.NumberOfPieces = GameConfig.GetPieceCount(difficulty); this.CodeBreakerGuesses = new List <GamePieces[]>(); this.GuessResults = new List <GuessResult[]>(); }
private void OnDifficulty(object sender, RoutedEventArgs e) { RadioButton radio = sender as RadioButton; if (sender != null) { computerLevel = (DifficultyLevels)Enum.Parse(typeof(DifficultyLevels), radio.Name); } }
public static void RemoveDifficulty(string difficulty) { if (DifficultyLevels.Contains(difficulty) && DifficultyLevels.Count > 1) { DifficultyLevels.Remove(difficulty); GlobalEvent.DispatchEvent(GameOptionEventEnum.DifficultyChange); SaveOption(); } }
public static void AddDifficulty(string difficulty) { if (!DifficultyLevels.Contains(difficulty)) { DifficultyLevels.Add(difficulty); GlobalEvent.DispatchEvent(GameOptionEventEnum.DifficultyChange); SaveOption(); } }
public void Add(DifficultyLevelsDataModel difficultyLevels) { DifficultyLevels difficultyLevelsInstance = new DifficultyLevels(); difficultyLevelsInstance.DifficultyLevelName = difficultyLevels.DifficultyLevelName; ContextGateway <DifficultyLevels> .Add(difficultyLevelsInstance); }
private void UpdateLevels() { if (SelectedDifficultyLevelScale != null) { DifficultyLevels.Clear(); foreach (DifficultyLevel difficultyLevel in _difficultyLevelService.GetAllIn(SelectedDifficultyLevelScale)) { DifficultyLevels.Add(difficultyLevel); } } }
public static int GetPieceCount(DifficultyLevels difficulty) { if (difficulty == DifficultyLevels.Beginner) { return(BeginnerGamePieceCount); } else { return(AdvancedGamePieceCount); } }
public void Solve_TrickyCase2() { var seed = 1448362612; var difficultyLevel = 1; var generatorConfig = new DifficultyLevels().GetConfig(seed, difficultyLevel); var testData = new InputGenerator(generatorConfig).Generate(); var result = Submission?.Solve(testData.Input); Assert.AreEqual(testData.Solution, result); }
public GameSettings(DifficultyLevels level) { if (level == DifficultyLevels.Custom) { throw new ArgumentOutOfRangeException("Передан уровень Custom без дополнительных параметров."); } DifficultyLevel = level; FieldWidth = Settings[level][0]; FieldHeight = Settings[level][1]; FieldMinesTotal = Settings[level][2]; }
/// <summary> /// Setzt vorbestimmte Werte /// </summary> /// <param name="name"></param> /// <param name="scale"></param> /// <param name="level"></param> public void PresetValues(string name, DifficultyLevelScale scale, DifficultyLevel level) { Name = name; if (DifficultyLevelScales.Any()) { SelectedDifficultyLevelScale = DifficultyLevelScales.FirstOrDefault(x => x.Id == scale.Id); } if (SelectedDifficultyLevelScale != null) { SelectedDifficultyLevel = DifficultyLevels.FirstOrDefault(x => x.Id == level.Id); } }
private void InitializeVariables(DifficultyLevels level) { _level = level; // Save the difficulty level that we are managing _stop = false; // Default the stop flag to false _qLock = new object(); // Instantiate a new lock object _makeMoreGames = new AutoResetEvent(false); // Instantiate a new AutoResetEven object _cGameGenerator = new GameGenerator(level); // Instantiate the game creator object _cGameGenerator.GameGeneratorEvent += GameGeneratorEventHandler; // Add the event handler lock (_qLock) // Obtain a lock on the queue object { _games = new Queue <CellClass[, ]>(); // Instantiate a new queue object } }
public PopUpDifficulty(DifficultyLevel level) { this.Level = level; InitializeComponent(); this.Uid = "1000"; this.Title = Translator.GetInstance().GetString("PopUpDifficulty", this.Uid); this.Width = 400; this.Height = 210; this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(10, 10, 10, 10); ListBox lbContent = new ListBox(); lbContent.ItemContainerStyleSelector = new ListBoxItemStyleSelector(); lbContent.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem"); mainPanel.Children.Add(lbContent); DifficultyLevel easyLevel = DifficultyLevels.GetDifficultyLevel("Easy"); DifficultyLevel normalLevel = DifficultyLevels.GetDifficultyLevel("Normal"); DifficultyLevel hardLevel = DifficultyLevels.GetDifficultyLevel("Hard"); slMoney = createDifficultySlider(easyLevel.MoneyLevel, normalLevel.MoneyLevel, hardLevel.MoneyLevel, level.MoneyLevel); slLoan = createDifficultySlider(easyLevel.LoanLevel, normalLevel.LoanLevel, hardLevel.LoanLevel, level.LoanLevel); slAI = createDifficultySlider(easyLevel.AILevel, normalLevel.AILevel, hardLevel.AILevel, level.AILevel); slPassengers = createDifficultySlider(easyLevel.PassengersLevel, normalLevel.PassengersLevel, hardLevel.PassengersLevel, level.PassengersLevel); slPrice = createDifficultySlider(easyLevel.PriceLevel, normalLevel.PriceLevel, hardLevel.PriceLevel, level.PriceLevel); slStartData = createDifficultySlider(easyLevel.StartDataLevel, normalLevel.StartDataLevel, hardLevel.StartDataLevel, level.StartDataLevel); lbContent.Items.Add(new QuickInfoValue("", createIndicator())); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "200"), slMoney)); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "201"), slPrice)); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "202"), slLoan)); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "203"), slPassengers)); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "204"), slAI)); lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "205"), slStartData)); mainPanel.Children.Add(createButtonsPanel()); this.Content = mainPanel; }
/// <summary> /// Liefert eine neue INstanz des Design View Models /// </summary> public NameAndLevelInputDesignViewModel() { Name = "Weg 1"; DifficultyLevelScales.Add(new DifficultyLevelScale() { Name = "Sächsisch" }); SelectedDifficultyLevelScale = DifficultyLevelScales.First(); DifficultyLevels.Add(new DifficultyLevel() { Name = "IV", Score = 500 }); SelectedDifficultyLevel = DifficultyLevels.First(); }
public PageCreateDifficulty() { this.Difficulties = new List <DifficultyMVVM>(); DifficultyLevel easyLevel = DifficultyLevels.GetDifficultyLevel("Easy"); DifficultyLevel normalLevel = DifficultyLevels.GetDifficultyLevel("Normal"); DifficultyLevel hardLevel = DifficultyLevels.GetDifficultyLevel("Hard"); this.Difficulties.Add(new DifficultyMVVM("money", Translator.GetInstance().GetString("PageCreateDifficulty", "1000"), easyLevel.MoneyLevel, normalLevel.MoneyLevel, hardLevel.MoneyLevel)); this.Difficulties.Add(new DifficultyMVVM("price", Translator.GetInstance().GetString("PageCreateDifficulty", "1001"), easyLevel.PriceLevel, normalLevel.PriceLevel, hardLevel.PriceLevel)); this.Difficulties.Add(new DifficultyMVVM("loan", Translator.GetInstance().GetString("PageCreateDifficulty", "1002"), easyLevel.LoanLevel, normalLevel.LoanLevel, hardLevel.LoanLevel)); this.Difficulties.Add(new DifficultyMVVM("passengers", Translator.GetInstance().GetString("PageCreateDifficulty", "1003"), easyLevel.PassengersLevel, normalLevel.PassengersLevel, hardLevel.PassengersLevel)); this.Difficulties.Add(new DifficultyMVVM("AI", Translator.GetInstance().GetString("PageCreateDifficulty", "1004"), easyLevel.AILevel, normalLevel.AILevel, hardLevel.AILevel)); this.Difficulties.Add(new DifficultyMVVM("startdata", Translator.GetInstance().GetString("PageCreateDifficulty", "1005"), easyLevel.StartDataLevel, normalLevel.StartDataLevel, hardLevel.StartDataLevel)); InitializeComponent(); }
/// <summary> /// LÄdt die VM relevanten Daten zu einer Schwierigkeitsgradskale /// </summary> /// <param name="difficultyLevelScale"></param> public void LoadData(DifficultyLevelScale difficultyLevelScale) { if (difficultyLevelScale == null) { throw new ArgumentNullException(nameof(difficultyLevelScale)); } _difficultyLevelScale = difficultyLevelScale; DifficultyLevels.Clear(); foreach (DifficultyLevel difficultyLevel in _difficultyLevelService.GetAllIn(_difficultyLevelScale)) { IItemWithNameAndScoreViewModel itemViewModel = new ItemWithNameAndScoreViewModel(); itemViewModel.LoadData(difficultyLevel); DifficultyLevels.Add(itemViewModel); } CommandManager.InvalidateRequerySuggested(); }
// Change the AI configuration based on the enum selection public virtual void SetCpuLevel(DifficultyLevels level) { cpuLevel = level; switch (level) { case DifficultyLevels.easy: moveSpeed = 7.0f; maxProtectedDistance = 3.0f; skillHeadButt.buttForce = 200; skillKick.kickForce = 160; attackCoolDown = 0.6f; SetJumpSettings(40f, 2.5f, 0.3f); break; case DifficultyLevels.normal: moveSpeed = 8.0f; maxProtectedDistance = 3.8f; skillHeadButt.buttForce = 220; skillKick.kickForce = 180; attackCoolDown = 0.5f; SetJumpSettings(50f, 3.5f, 0.2f); break; case DifficultyLevels.hard: moveSpeed = 9.0f; maxProtectedDistance = 5f; skillHeadButt.buttForce = 250; skillKick.kickForce = 200; attackCoolDown = 0.4f; SetJumpSettings(60f, 3.5f, 0.1f); break; case DifficultyLevels.veryHard: moveSpeed = 11.0f; maxProtectedDistance = 6f; skillHeadButt.buttForce = 270; skillKick.kickForce = 220; attackCoolDown = 0.3f; SetJumpSettings(60f, 3.5f, 0.05f); break; } }
private void btnAddDifficulty_Click(object sender, RoutedEventArgs e) { object o = PopUpDifficulty.ShowPopUp((DifficultyLevel)cbDifficulty.SelectedItem); if (o != null && o is DifficultyLevel) { DifficultyLevel level = (DifficultyLevel)o; if (DifficultyLevels.GetDifficultyLevel("Custom") != null) { DifficultyLevel customLevel = DifficultyLevels.GetDifficultyLevel("Custom"); DifficultyLevels.RemoveDifficultyLevel(customLevel); cbDifficulty.Items.Remove(customLevel); } DifficultyLevels.AddDifficultyLevel(level); cbDifficulty.Items.Add(level); cbDifficulty.SelectedItem = level; } }
//create the slider indicator private Grid createIndicator() { Grid grdIndicator = UICreator.CreateGrid(3); grdIndicator.Width = 200; TextBlock txtEasy = UICreator.CreateTextBlock(DifficultyLevels.GetDifficultyLevel("Easy").Name); TextBlock txtNormal = UICreator.CreateTextBlock(DifficultyLevels.GetDifficultyLevel("Normal").Name); TextBlock txtHard = UICreator.CreateTextBlock(DifficultyLevels.GetDifficultyLevel("Hard").Name); Grid.SetColumn(txtEasy, 0); grdIndicator.Children.Add(txtEasy); txtNormal.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; Grid.SetColumn(txtNormal, 1); grdIndicator.Children.Add(txtNormal); Grid.SetColumn(txtHard, 2); txtHard.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; grdIndicator.Children.Add(txtHard); return(grdIndicator); }
/// <summary> /// Initializes a new instance of the MaskPuzzle class. /// </summary> /// <param name="Level">The difficulty level to mask to.</param> internal MaskPuzzle(DifficultyLevels Level) { _level = Level; }
/// <summary> /// Initializes a new instance of the GameManagerEventArgs class. /// </summary> /// <param name="level">Difficulty level of the count.</param> /// <param name="count">Number of games generated and saved.</param> internal GameManagerEventArgs(DifficultyLevels level, Int32 count) { Level = level; // Save the input paramters. Count = count; }