private bool IsTotalWeightHigherOrEqualToUsedWeight() { if (Decimal.ToInt32(numericUpDownTotalWeight.Value) >= Uncategorized.GetTotalCombinedWeight(WeightedNamedOutcome.Outcomes)) { return(true); } return(false); }
public SimulationRepresentationForm(int totalWeight, int numberOfRepeats, BindingList <WeightedNamedOutcome> outcomes, List <int> results) { InitializeComponent(); listViewSimulationResult.View = View.Details; FillListView(outcomes); this.totalWeight = totalWeight; this.numberOfRepeats = numberOfRepeats; this.totalUsedWeight = Uncategorized.GetTotalCombinedWeight(outcomes); InitializeTextValues(); }
public void Init() { outcomes.Add(new WeightedNamedOutcome("Stian1", 1, false)); outcomes.Add(new WeightedNamedOutcome("Stian2", 2, false)); outcomes.Add(new WeightedNamedOutcome("Stian3", 3, false)); outcomes.Add(new WeightedNamedOutcome("Stian4", 4, false)); outcomes.Add(new WeightedNamedOutcome("Stian5", 5, false)); outcomes.Add(new WeightedNamedOutcome("Stian6", 6, false)); outcomes.Add(new WeightedNamedOutcome("Stian7", 7, false)); outcomes.Add(new WeightedNamedOutcome("Stian8", 8, false)); outcomes.Add(new WeightedNamedOutcome("Stian9", 9, false)); outcomes.Add(new WeightedNamedOutcome("Stian10", 10, false)); results.Add(1); results.Add(1); results.Add(2); results.Add(3); results.Add(4); results.Add(6); results.Add(7); results.Add(10); results.Add(11); results.Add(15); results.Add(16); results.Add(21); results.Add(22); results.Add(28); results.Add(29); results.Add(36); results.Add(37); results.Add(45); results.Add(46); results.Add(55); results.Add(56); results.Add(110); outcomes = Uncategorized.AddNothingOutcome(outcomes, totalWeight, Uncategorized.GetTotalCombinedWeight(outcomes)); outcomes = ResultAndOutcomeMerger.AssignNumberRangeToOutcomes(outcomes); }
private void ButtonGenerate_Click(object sender, EventArgs e) { ResetSimulationData(); if (!IsTotalWeightHigherOrEqualToUsedWeight()) { MessageBox.Show("The total weight must be higher than or equal to the weight used by your outcomes.", "Weight not legal(get a lawyer)", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int totalWeight = Decimal.ToInt32(numericUpDownTotalWeight.Value); int numberOfRepeats = Decimal.ToInt32(numericUpDownNumberOfRounds.Value); int usedWeight = Uncategorized.GetTotalCombinedWeight(WeightedNamedOutcome.Outcomes); List <int> results = GetResults(totalWeight, numberOfRepeats); CompleteOutcomeSimulation(totalWeight, usedWeight, results); SimulationRepresentationForm simulationRepresentationForm = new SimulationRepresentationForm(totalWeight, numberOfRepeats, WeightedNamedOutcome.Outcomes, results); simulationRepresentationForm.Show(); }
public void UpdateCurrentUsedWeight() { //keep up-to-date textBoxCurrentUsedWeight.Text = "Current used weight: " + Uncategorized.GetTotalCombinedWeight(WeightedNamedOutcome.Outcomes); }