示例#1
0
        private static void Main(string[] args)
        {
            var env = new EnvironmentMas(noTurns: 100);
            var a1  = new MyAgent(); env.Add(a1, "agent1");
            var a2  = new MyAgent(); env.Add(a2, "agent2");
            var m   = new MonitorAgent(); env.Add(m, "monitor");

            env.Start();
        }
示例#2
0
        private static void Main(string[] args)
        {
            // === Init ===

            var env = new ConcurrentEnvironment();
            var a1  = new MyAgent(); env.Add(a1, "agent1");
            var a2  = new MyAgent(); env.Add(a2, "agent2");
            var m   = new MonitorAgent(); env.Add(m, "monitor");

            // === Run ===

            m.Start(); a1.Start(); a2.Start();

            // === Wait ===

            env.WaitAll();
        }