diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index b18b7b3..e47c5b6 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -332,7 +332,28 @@ class Crops public float getProductionRate(CropTypes Sample) { - + float predProd = 1.0f; + if (Status > 1) + { + bool correctSeason = false; + foreach (string i in Sample.Season) + { + if (i == Time.getTimeOfYear() || i == "Whole Year") + { + correctSeason = true; + break; + } + } + + if (correctSeason) + { + predProd = Game1.Sources.ML_Joel.Engine.PredictProductionwithRainfall(soilProperties, Time); + predProd = (predProd / soilProperties.Area) / 2; + } + else + predProd = 0.20f; + } + ProductionRate = 1; float min = 1.0f; if (DataSet != null) @@ -371,7 +392,7 @@ class Crops ProductionRate = ProductionRate / 1.5f; } ProductionRate = (float)Math.Pow(ProductionRate, 2.5f); - return ProductionRate; + return ProductionRate * predProd; } public float getProductionRate() diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs index 05568d1..c99cfa1 100644 --- a/Game1/Sources/Crops/Farm.cs +++ b/Game1/Sources/Crops/Farm.cs @@ -77,8 +77,8 @@ class Farm init(Size, housepos); RainPosition.X = r.Next(0, 1900); RainPosition.Y = r.Next(0, 1950); - RainfallMap = PerlinNoise.LoadImage("C:\\Users\\Joel\\source\\repos\\Oskars Repo\\Game1\\Content\\Rainfall.png"); - //RainfallMap = PerlinNoise.LoadImage("C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/Rainfall.png"); + //RainfallMap = PerlinNoise.LoadImage("C:\\Users\\Joel\\source\\repos\\Oskars Repo\\Game1\\Content\\Rainfall.png"); + RainfallMap = PerlinNoise.LoadImage("C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/Rainfall.png"); } public Rectangle getRainPosition(int TileSize, int x, int y, Vector2 Size) diff --git a/Game1/Sources/ML_Joel/Engine.cs b/Game1/Sources/ML_Joel/Engine.cs index e4b31af..aac86d7 100644 --- a/Game1/Sources/ML_Joel/Engine.cs +++ b/Game1/Sources/ML_Joel/Engine.cs @@ -35,13 +35,13 @@ namespace Game1.Sources.ML_Joel PredictionEngineArea = Model.CreateEngineArea(); } - public static float PredictProductionwithRainfall(Crops crop, CropTypes cropTypes) + public static float PredictProductionwithRainfall(SoilProperties soilProperties, DayNightCycle Time) { InputArea modelInput = new InputArea { - //Season = , - //Area = crop.getSoilProperties().Area, - Rainfall = crop.getSoilProperties().Humidity, + Season = Time.getTimeOfYear(), + Area = soilProperties.Area, + Rainfall = soilProperties.Humidity, }; return PredictionEngineArea.Predict(modelInput).Score; diff --git a/Game1/Sources/Smart/SmartTractor.cs b/Game1/Sources/Smart/SmartTractor.cs index 20c3d21..1eba621 100644 --- a/Game1/Sources/Smart/SmartTractor.cs +++ b/Game1/Sources/Smart/SmartTractor.cs @@ -16,7 +16,7 @@ class SmartTractor //What to do next public Path returnChoice() { - //System.Threading.St + //System.Threading.ThreadStart tractorThread = new System.Threading.ThreadStart(farm.UpdatePreferedCrops); ai.update(farm, Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target / (tileSize + Spacing), Rotation); farm.UpdatePreferedCrops(Size); farm = ai.changeCropStatus();