Exemple #1
0
        private static void Main(string[] args)
        {
            var env = new MyEnvironment(noTurns: 10, delayAfterTurn: 100, parallel: true);
            //var env = new MyEnvironment(noTurns: 10, delayAfterTurn: 100, randomOrder: false, parallel: false);

            int noAgents = 4;

            for (int i = 1; i <= noAgents; i++)
            {
                var a = new MyAgent();
                env.Add(a, $"agent{i}");
            }

            var m = new MonitorAgent();

            env.Add(m, "monitor");

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

            int noAgents = 10;

            for (int i = 1; i <= noAgents; i++)
            {
                var a = new MyAgent();
                env.Add(a, "agent" + i);
                a.Start();
            }

            var m = new MonitorAgent();

            env.Add(m, "monitor");
            m.Start();

            env.WaitAll();
        }