summaryrefslogtreecommitdiff
path: root/MorgSimulator/Dish.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MorgSimulator/Dish.cs')
-rw-r--r--MorgSimulator/Dish.cs17
1 files changed, 7 insertions, 10 deletions
diff --git a/MorgSimulator/Dish.cs b/MorgSimulator/Dish.cs
index 1813d5a..38f1bc0 100644
--- a/MorgSimulator/Dish.cs
+++ b/MorgSimulator/Dish.cs
@@ -1,29 +1,26 @@
-using System.Collections.Generic;
-using System.Linq;
+using MorgSimulator.Framework;
namespace MorgSimulator
{
- public class Dish
+ public class Dish : Simulator<Morg>
{
- private readonly List<Morg> _morgs = [];
-
public void AddMorg(Morg morg)
{
- _morgs.Add(morg);
+ AddEntity(morg);
}
- public List<Morg> GetAllMorgs()
+ public System.Collections.Generic.List<Morg> GetAllMorgs()
{
- return [.. _morgs];
+ return [.. _entities];
}
#nullable enable
- public Morg? FindNearestPrey(Morg predator)
+ protected override Entity? FindNearestPrey(Morg predator)
{
Morg? nearestPrey = null;
double nearestDistance = double.MaxValue;
- foreach (var potentialPrey in _morgs)
+ foreach (var potentialPrey in _entities)
if (potentialPrey.IsAlive &&
potentialPrey != predator &&
predator.CanEat(potentialPrey.Type))