From e2f903eb8c074a1f3cf2ef31624bb9562355110d Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 10 May 2020 16:00:39 +0200 Subject: [PATCH] Strange results --- Game1/Game1.cs | 2 +- Game1/Sources/ML/MLModel.cs | 12 ++++++------ Game1/Sources/Objects/Tractor.cs | 23 ++++++++++++++++++++++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Game1/Game1.cs b/Game1/Game1.cs index cbbff67..40b9fcf 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -69,7 +69,7 @@ namespace Game1 //Generates the map with some random values inventory.initInventorySystem(); - input.init(graphics, new Vector2(16,16), 56, 1); //Generates the starting size + input.init(graphics, new Vector2(16,16), 56, 10); //Generates the starting size houseUnit.init(input.getTileSize(), input.getSpacing()); //Generates the house position tractorUnit.init(houseUnit.GetRectangle(), input); //Generates the Tractor tractorUnit.updateSizing(input, 0, houseUnit.getVector(), Time); //Updates the first Size of the Tractor diff --git a/Game1/Sources/ML/MLModel.cs b/Game1/Sources/ML/MLModel.cs index 7a1870a..a6aebe2 100644 --- a/Game1/Sources/ML/MLModel.cs +++ b/Game1/Sources/ML/MLModel.cs @@ -11,12 +11,12 @@ using Microsoft.ML.Trainers.LightGbm; class MLModel { private static MLContext mlContext = new MLContext(seed: 1); - private static string path = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/Fertilizer_Prediction.csv"; - private static string modelpath = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodel"; - private static string report = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report"; - private static string pathBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/BigFertPredict.csv"; - private static string modelpathBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodelBig"; - private static string reportBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report_BigModel"; + private static string path = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/Fertilizer_Prediction.csv"; + private static string modelpath = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodel"; + private static string report = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report"; + private static string pathBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/BigFertPredict.csv"; + private static string modelpathBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodelBig"; + private static string reportBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report_BigModel"; // Loading data, creatin and saving ML model for smaller dataset (100) public static void CreateModel() diff --git a/Game1/Sources/Objects/Tractor.cs b/Game1/Sources/Objects/Tractor.cs index f56278d..d071f44 100644 --- a/Game1/Sources/Objects/Tractor.cs +++ b/Game1/Sources/Objects/Tractor.cs @@ -9,7 +9,9 @@ class Tractor private Path path = new Path(); private SmartTractor smartTractor = new SmartTractor(); private HandleRotation handleRotation = new HandleRotation(); - private int j = 60; + private int WaitFrame = 30; + private int j; + public void updateSizing(Input input, int Status, Vector2 newHousePos, DayNightCycle Time) @@ -63,10 +65,29 @@ class Tractor public void updatePosition(Vector2 Size, int Status) // updates the position { + //farm.updateSize(Size, sizeTile, Spacing); for (int i = 0; i < Speed; i++) { + updateDirection(Size, Position); + + + /* + if (!smartTractor.getWaitTwoFrames()) + { + updateDirection(Size, Position); + j = WaitFrame; + } + else if (j != 0) + { + j--; + } + else + { + smartTractor.setWaitTwoFrames(false); + }*/ + } }