From 0ee2b4194c30d7bfffe70ff3947af8502c870ca0 Mon Sep 17 00:00:00 2001 From: lorenzosenarigo Date: Tue, 30 Jan 2024 16:53:59 +0100 Subject: [PATCH] added configurable max and min random walk distance (#46) --- GeoRasterBlueprint/Model/AbstractAnimal.cs | 14 +++++++++++-- GeoRasterBlueprint/Model/Moose.cs | 2 +- GeoRasterBlueprint/config.json | 24 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/GeoRasterBlueprint/Model/AbstractAnimal.cs b/GeoRasterBlueprint/Model/AbstractAnimal.cs index 29d971b..e72b628 100644 --- a/GeoRasterBlueprint/Model/AbstractAnimal.cs +++ b/GeoRasterBlueprint/Model/AbstractAnimal.cs @@ -74,8 +74,18 @@ public abstract class AbstractAnimal : IPositionable, IAgent { protected int _herdId { get; } public static Random _random = new (); - private const int RandomWalkMaxDistanceInM = 500; - private const int RandomWalkMinDistanceInM = 10; + + /// + /// Should be dependent from tick length + /// + [PropertyDescription] + public int RandomWalkMaxDistanceInM { get; set; } + /// + /// Should be dependent from tick length + /// + [PropertyDescription] + public int RandomWalkMinDistanceInM { get; set; } + public const double MaxHydration = 100.0; public const double MaxSatiety = 100.0; public const int MaxAge = 25; diff --git a/GeoRasterBlueprint/Model/Moose.cs b/GeoRasterBlueprint/Model/Moose.cs index a70b1dc..c6827ca 100644 --- a/GeoRasterBlueprint/Model/Moose.cs +++ b/GeoRasterBlueprint/Model/Moose.cs @@ -102,7 +102,7 @@ public class Moose : AbstractAnimal { public static double DailyWaterAdolescent { get; set; } #endregion public override void Tick() { - + _hoursLived++; if (_hoursLived % 1 == 0 && _pregnant) { if (_pregnancyDuration < 6) { diff --git a/GeoRasterBlueprint/config.json b/GeoRasterBlueprint/config.json index 9d89a81..e60a730 100644 --- a/GeoRasterBlueprint/config.json +++ b/GeoRasterBlueprint/config.json @@ -64,6 +64,14 @@ { "parameter": "DailyWaterCalf", "value": 17 + }, + { + "parameter": "RandomWalkMaxDistanceInM", + "value": 500 + }, + { + "parameter": "RandomWalkMinDistanceInM", + "value": 10 } ], "file":"Resources/bisons.csv", @@ -97,6 +105,14 @@ { "parameter": "DailyWaterCalf", "value": 79 + }, + { + "parameter": "RandomWalkMaxDistanceInM", + "value": 500 + }, + { + "parameter": "RandomWalkMinDistanceInM", + "value": 10 } ], "file":"Resources/moose.csv", @@ -130,6 +146,14 @@ { "parameter": "DailyWaterCalf", "value": 9 + }, + { + "parameter": "RandomWalkMaxDistanceInM", + "value": 500 + }, + { + "parameter": "RandomWalkMinDistanceInM", + "value": 10 } ], "file":"Resources/elks.csv",