1
0
forked from s425077/PotatoPlan
This commit is contained in:
Joel 2020-05-24 17:08:41 +02:00
parent f63bdcee77
commit 0a31c36c93
3 changed files with 11 additions and 10 deletions

View File

@ -272,6 +272,7 @@ class Crops
housePos = state; housePos = state;
if (state) if (state)
{ {
Timer = 1;
Status = 1; Status = 1;
} }
else else

View File

@ -75,7 +75,7 @@ class Farm
RainPosition.X = 1980; RainPosition.X = 1980;
RainPosition.Y = 800; RainPosition.Y = 800;
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/Oskar/source/repos/PotatoPlanFinal/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) public Rectangle getRainPosition(int TileSize, int x, int y)
@ -100,9 +100,9 @@ class Farm
public Rectangle getDestinationRectangle(int x, int y, Vector2 Size) public Rectangle getDestinationRectangle(int x, int y, Vector2 Size)
{ {
Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y)); Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X - 1) if (temp.X >= 1999 - Size.X - 1)
temp.X = (1999 - (int)Math.Round(RainPosition.X)); temp.X = (1999 - (int)Math.Round(RainPosition.X));
if (RainPosition.Y >= 1999 - Size.Y - 1) if (temp.Y >= 1999 - Size.Y - 1)
temp.Y = (1999 - (int)Math.Round(RainPosition.Y)); temp.Y = (1999 - (int)Math.Round(RainPosition.Y));
return new Rectangle(x + (int)temp.X, y + (int)temp.Y, 1, 1); return new Rectangle(x + (int)temp.X, y + (int)temp.Y, 1, 1);
} }
@ -124,9 +124,9 @@ class Farm
for (int j = 0; j < Size.Y; j++) for (int j = 0; j < Size.Y; j++)
{ {
Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y)); Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X - 1) if (temp.X >= 1999 - Size.X - 1)
temp.X = (1999 - (int)Math.Round(RainPosition.X)); temp.X = (1999 - (int)Math.Round(RainPosition.X));
if (RainPosition.Y >= 1999 - Size.Y - 1) if (temp.Y >= 1999 - Size.Y - 1)
temp.Y = (1999 - (int)Math.Round(RainPosition.Y)); temp.Y = (1999 - (int)Math.Round(RainPosition.Y));
crops[i, j].updateCrop(Size, RainfallMap[(int)Math.Round(temp.X) + i][(int)Math.Round(temp.Y) + j].GetBrightness()); crops[i, j].updateCrop(Size, RainfallMap[(int)Math.Round(temp.X) + i][(int)Math.Round(temp.Y) + j].GetBrightness());
} }
@ -256,9 +256,9 @@ class Farm
public Color getRainAmount(int x, int y, Color color, Vector2 Size) public Color getRainAmount(int x, int y, Color color, Vector2 Size)
{ {
Vector2 temp = new Vector2(x + (int)Math.Round(RainPosition.X), y + (int)Math.Round(RainPosition.Y)); Vector2 temp = new Vector2(x + (int)Math.Round(RainPosition.X), y + (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X - 1) if (temp.X >= 1999 - Size.X - 1)
temp.X = (1999 - (int)Math.Round(RainPosition.X) + x); temp.X = (1999 - (int)Math.Round(RainPosition.X) + x);
if (RainPosition.Y >= 1999 - Size.Y - 1) if (temp.Y >= 1999 - Size.Y - 1)
temp.Y = (1999 - (int)Math.Round(RainPosition.Y) + y); temp.Y = (1999 - (int)Math.Round(RainPosition.Y) + y);
if (temp.X == -1) if (temp.X == -1)
temp.X = 1999; temp.X = 1999;

View File

@ -20,9 +20,9 @@ class MLModel
private static string modelpathBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodelBig"; 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"; private static string reportBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report_BigModel";
private static string path = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/Fertilizer_Prediction.csv"; private static string path = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/Fertilizer_Prediction.csv";
private static string modelpath = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodel"; private static string modelpath = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodel";
private static string report = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report"; private static string report = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report";
// Loading data, creatin and saving ML model for smaller dataset (100) // Loading data, creatin and saving ML model for smaller dataset (100)
public static void CreateModel() public static void CreateModel()