예제 #1
0
        private static void Main(string[] args)
        {
            var env = new TurnBasedEnvironment(0, 100); // no turn limit, delay 100 ms

            var planetAgent = new PlanetAgent();

            env.Add(planetAgent, "planet");

            for (int i = 1; i <= 5; i++) // 5 explorers
            {
                var explorerAgent = new ExplorerAgent();
                env.Add(explorerAgent, $"explorer{i}");
            }

            env.Memory.Add("Size", 11);
            env.Memory.Add("NoResources", 10);

            env.Start();
        }
예제 #2
0
        private static void Main(string[] args)
        {
            var env = new EnvironmentMas(delayAfterTurn: 100); // no turn limit, run in parallel

            var planetAgent = new PlanetAgent();

            env.Add(planetAgent, "planet");

            for (int i = 1; i <= 5; i++) // 5 explorers
            {
                var explorerAgent = new ExplorerAgent();
                env.Add(explorerAgent, $"explorer{i}");
            }

            env.Memory.Add("Size", 11);
            env.Memory.Add("NoResources", 10);

            env.Start();
        }
예제 #3
0
        private static void Main(string[] args)
        {
            var env = new ConcurrentEnvironment();

            var planetAgent = new PlanetAgent();

            env.Add(planetAgent, "planet");
            planetAgent.Start();

            Thread.Sleep(100);

            for (int i = 1; i <= Utils.NoExplorers; i++)
            {
                var explorerAgent = new ExplorerAgent();
                env.Add(explorerAgent, "explorer" + i);
                explorerAgent.Start();
            }

            env.WaitAll();
        }
예제 #4
0
 public void SetOwner(PlanetAgent a)
 {
     _ownerAgent = a;
     _size       = a.Environment.Memory["Size"];
 }
예제 #5
0
 public void SetOwner(PlanetAgent a)
 {
     _ownerAgent = a;
 }