This commit is contained in:
Joel 2020-05-24 22:24:32 +02:00
commit 94c2792ef3
4 changed files with 30 additions and 9 deletions

View File

@ -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()

View File

@ -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)

View File

@ -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;

View File

@ -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();