1
0
forked from s425077/PotatoPlan
This commit is contained in:
BOTLester 2020-06-14 18:01:51 +02:00
parent 631ad7c12f
commit 2e96d5a2d5
3 changed files with 6 additions and 4 deletions

View File

@ -79,8 +79,8 @@ class Farm
RainPosition.Y = r.Next(0, 1950); RainPosition.Y = r.Next(0, 1950);
WindSpeed.X = GetRandomNumber(-1f, 1f) / 500; WindSpeed.X = GetRandomNumber(-1f, 1f) / 500;
WindSpeed.Y = GetRandomNumber(-1f, 1f) / 500; WindSpeed.Y = GetRandomNumber(-1f, 1f) / 500;
RainfallMap = PerlinNoise.LoadImage("C:\\Users\\Joel\\source\\repos\\Oskars Repo\\Game1\\Content\\Rainfall.png"); //RainfallMap = PerlinNoise.LoadImage("C:\\Users\\Joel\\source\\repos\\Oskars Repo\\Game1\\Content\\Rainfall.png");
//RainfallMap = PerlinNoise.LoadImage("C:/Users/oel/source/repos/Oscars 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) public Rectangle getRainPosition(int TileSize, int x, int y, Vector2 Size)

View File

@ -10,6 +10,7 @@ static class Engine
{ {
private static MLContext mlContext = new MLContext(seed: 1); private static MLContext mlContext = new MLContext(seed: 1);
private static PredictionEngine<ModelInput, ModelOutput> PredictionEngine; private static PredictionEngine<ModelInput, ModelOutput> PredictionEngine;
private static ModelOutput modelOutput;
public static void init() public static void init()
{ {
@ -30,7 +31,7 @@ static class Engine
Phosporous = crop.getSoilProperties().Phosphorous Phosporous = crop.getSoilProperties().Phosphorous
}; };
ModelOutput modelOutput = new ModelOutput(); //ModelOutput modelOutput = new ModelOutput();
PredictionEngine.Predict(modelInput, ref modelOutput); PredictionEngine.Predict(modelInput, ref modelOutput);
return modelOutput.Prediction; return modelOutput.Prediction;
} }

View File

@ -13,6 +13,7 @@ namespace Game1.Sources.ML_Joel
private static MLContext mlContext = new MLContext(seed: 1); private static MLContext mlContext = new MLContext(seed: 1);
private static PredictionEngine<Input, Output> PredictionEngine; private static PredictionEngine<Input, Output> PredictionEngine;
private static PredictionEngine<InputArea, OutputArea> PredictionEngineArea; private static PredictionEngine<InputArea, OutputArea> PredictionEngineArea;
private static OutputArea modelOutput;
public static void CreateModel() public static void CreateModel()
@ -44,7 +45,7 @@ namespace Game1.Sources.ML_Joel
Rainfall = soilProperties.prevRainfall, Rainfall = soilProperties.prevRainfall,
}; };
OutputArea modelOutput = new OutputArea(); //OutputArea modelOutput = new OutputArea();
PredictionEngineArea.Predict(modelInput, ref modelOutput); PredictionEngineArea.Predict(modelInput, ref modelOutput);
return modelOutput.Score; return modelOutput.Score;
} }