Skip to content

Commit

Permalink
added configurable max and min random walk distance (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzosenarigo committed Jan 30, 2024
1 parent 6a8e4b5 commit 0ee2b41
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
14 changes: 12 additions & 2 deletions GeoRasterBlueprint/Model/AbstractAnimal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,18 @@ public abstract class AbstractAnimal : IPositionable, IAgent<LandscapeLayer> {
protected int _herdId { get; }

public static Random _random = new ();
private const int RandomWalkMaxDistanceInM = 500;
private const int RandomWalkMinDistanceInM = 10;

/// <summary>
/// Should be dependent from tick length
/// </summary>
[PropertyDescription]
public int RandomWalkMaxDistanceInM { get; set; }
/// <summary>
/// Should be dependent from tick length
/// </summary>
[PropertyDescription]
public int RandomWalkMinDistanceInM { get; set; }

public const double MaxHydration = 100.0;
public const double MaxSatiety = 100.0;
public const int MaxAge = 25;
Expand Down
2 changes: 1 addition & 1 deletion GeoRasterBlueprint/Model/Moose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 24 additions & 0 deletions GeoRasterBlueprint/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
{
"parameter": "DailyWaterCalf",
"value": 17
},
{
"parameter": "RandomWalkMaxDistanceInM",
"value": 500
},
{
"parameter": "RandomWalkMinDistanceInM",
"value": 10
}
],
"file":"Resources/bisons.csv",
Expand Down Expand Up @@ -97,6 +105,14 @@
{
"parameter": "DailyWaterCalf",
"value": 79
},
{
"parameter": "RandomWalkMaxDistanceInM",
"value": 500
},
{
"parameter": "RandomWalkMinDistanceInM",
"value": 10
}
],
"file":"Resources/moose.csv",
Expand Down Expand Up @@ -130,6 +146,14 @@
{
"parameter": "DailyWaterCalf",
"value": 9
},
{
"parameter": "RandomWalkMaxDistanceInM",
"value": 500
},
{
"parameter": "RandomWalkMinDistanceInM",
"value": 10
}
],
"file":"Resources/elks.csv",
Expand Down

0 comments on commit 0ee2b41

Please sign in to comment.