public void ComplexIngredients(LinearScaling linearScaling, int percentageComplexItems, List <GameObject> complexIngredients) { this.r = new System.Random(); this.recipes = new List <Recipe>(); this.complexIngredients = complexIngredients; this.percentageComplexItems = percentageComplexItems; this.linearScaling = linearScaling; }
public void ApplyTest() { object[,] data = { { "Id", "IsSmoker", "Age" }, { 0, 1, 10 }, { 1, 1, 15 }, { 2, 0, 40 }, { 3, 1, 20 }, { 4, 0, 70 }, { 5, 0, 55 }, }; DataTable input = data.ToTable(); var smoker = new LinearScaling(); var common = new LinearScaling(); smoker.Columns.Add(new LinearScaling.Options("Age") { SourceRange = new DoubleRange(10, 20), OutputRange = new DoubleRange(-1, 0) }); common.Columns.Add(new LinearScaling.Options("Age") { SourceRange = new DoubleRange(40, 70), OutputRange = new DoubleRange(0, 1) }); var settings = new Branching.Options("IsSmoker"); settings.Filters.Add(1, smoker); settings.Filters.Add(0, common); Branching branching = new Branching(settings); DataTable actual = branching.Apply(input); double[] expected = { -1, -0.5, 0, 0, 1, 0.5 }; foreach (DataRow row in actual.Rows) { int id = (int)row[0]; double age = (double)row[2]; Assert.AreEqual(expected[id], age); } }
public void ApplyTest() { DataTable input = new DataTable("Sample data"); input.Columns.Add("x", typeof(double)); input.Columns.Add("y", typeof(double)); input.Rows.Add(0.0, 0); input.Rows.Add(0.2, -20); input.Rows.Add(0.8, -80); input.Rows.Add(1.0, -100); DataTable expected = new DataTable("Sample data"); expected.Columns.Add("x", typeof(double)); expected.Columns.Add("y", typeof(double)); expected.Rows.Add(0, 1); expected.Rows.Add(20, 0.8); expected.Rows.Add(80, 0.2); expected.Rows.Add(100, 0.0); LinearScaling target = new LinearScaling("x", "y"); target.Columns["x"].OutputRange = new DoubleRange(0, 100); target.Columns["y"].OutputRange = new DoubleRange(0, 1); target.Detect(input); DataTable actual = target.Apply(input); for (int i = 0; i < actual.Rows.Count; i++) { double ex = (double)expected.Rows[i][0]; double ey = (double)expected.Rows[i][1]; double ax = (double)actual.Rows[i][0]; double ay = (double)actual.Rows[i][1]; Assert.AreEqual(ex, ax); Assert.AreEqual(ey, ay); } }
public void StartGame() { ls = new LinearScaling(5); this.pg.ResetPages(); GameMenu.SetActive(false); RecipesMenu.SetActive(true); Restaurant.SetActive(true); XpBar.SetActive(true); IngredientsMenu.SetActive(false); hintsBtn.gameObject.SetActive(false); ingridientsReadyBtn.gameObject.SetActive(false); recipiesBtn.gameObject.SetActive(true); allToChooseFrom = new List <GameObject>(); chosenIngredients = new List <GameObject>(); ClearRecipeSlots(); ClearIngredientSlots(); recipesClass = new List <Recipe>(); tutorial.gameObject.SetActive(true); days++; dayCounter.text = days.ToString(); ShuffleList(ingredients); AudioManager.instance.PlaySound("DisplayMenu"); recipesClass = ls.CreateRecipe(ingredients); for (int i = 0; i < recipesClass.Count; i++) { for (int j = 0; j < recipesClass.ElementAt(i).GetIngredients().Count; j++) { GameObject newIngridient = Instantiate(recipesClass.ElementAt(i).GetIngredients()[j], recipes[i].transform.GetChild(j)); newIngridient.GetComponent <Transform>().localPosition = new Vector3(-4f, 0, -1); newIngridient.GetComponent <Transform>().localScale = new Vector3(5, 5, 1); chosenIngredients.Add(newIngridient); } } foreach (GameObject recipe in recipes) { this.pg.AddPage(recipe); } this.pg.ActivatePages(); }
public void ApplyTest() { DataTable input = new DataTable("Sample data"); input.Columns.Add("x", typeof(double)); input.Columns.Add("y", typeof(double)); input.Rows.Add(0.0, 0); input.Rows.Add(0.2, -20); input.Rows.Add(0.8, -80); input.Rows.Add(1.0, -100); DataTable expected = new DataTable("Sample data"); expected.Columns.Add("x", typeof(double)); expected.Columns.Add("y", typeof(double)); expected.Rows.Add(0, 1); expected.Rows.Add(20, 0.8); expected.Rows.Add(80, 0.2); expected.Rows.Add(100, 0.0); LinearScaling target = new LinearScaling("x","y"); target.Columns["x"].OutputRange = new DoubleRange(0, 100); target.Columns["y"].OutputRange = new DoubleRange(0, 1); target.Detect(input); DataTable actual = target.Apply(input); for (int i = 0; i < actual.Rows.Count; i++) { double ex = (double)expected.Rows[i][0]; double ey = (double)expected.Rows[i][1]; double ax = (double)actual.Rows[i][0]; double ay = (double)actual.Rows[i][1]; Assert.AreEqual(ex, ax); Assert.AreEqual(ey, ay); } }