1
0
forked from s425077/PotatoPlan

fixed map generation

This commit is contained in:
Joel 2020-05-10 23:56:52 +02:00
parent 5424c2c66a
commit e868578f9b
3 changed files with 14 additions and 12 deletions

View File

@ -47,7 +47,7 @@ class Crops
public float getSpeedFactor(float tractorSpeed)
{
return 1f / getCostOnMovement();
return (1f * tractorSpeed) / getCostOnMovement();
}
public SoilProperties getSoilProperties()

View File

@ -21,6 +21,7 @@ class Farm
PresetCrops.init();
r = new Random();
crops = new Crops[100, 100];
int dirtCount = 0;
for (int i = 0; i < 99; i++)
{
for (int j = 0; j < 99; j++)
@ -40,20 +41,22 @@ class Farm
x = r.Next(0, 12);
crops[i, j].setCropType(x, PresetCrops.getPresetCropTypes(x));
crops[i, j].init();
if (crops[i, j].getStatus() == 2)
{
dirtCount++;
}
}
}
/*
int dirtCount = 0;
for (int i = 0; i < 99; i++)
{
for (int j = 0; j < 99; j++)
{
if (crops[i, j].getStatus() == 2)
{
dirtCount++;
if (!astar.isReachable(crops, new Vector2((int)i, (int)j), housepos))
{
crops[i, j].setStatus(1);
//crops[i, j].setStatus(1);
dirtCount--;
}
}
@ -61,7 +64,6 @@ class Farm
}
if (dirtCount == 0)
init(Size, housepos);
*/
}
public void updateFarm(Vector2 Size)

View File

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