private static void Main(string[] args) { var env = new IPDEnvironment(noTurns: 10); var prisonerAgent1 = new TitForTatPrisonerAgent(); var prisonerAgent2 = new TitForTatPrisonerAgent(); //var prisonerAgent1 = new ConfessPrisonerAgent(); //var prisonerAgent2 = new RandomPrisonerAgent(); env.Add(prisonerAgent1, $"p1-{prisonerAgent1.GetType().Name}"); env.Add(prisonerAgent2, $"p2-{prisonerAgent2.GetType().Name}"); var policeAgent = new PoliceAgent(); env.Add(policeAgent, "police"); env.Start(); }
private static void Main(string[] args) { var env = new ConcurrentEnvironment(); //var prisonerAgent1 = new ConfessPrisonerAgent(); //var prisonerAgent2 = new RandomPrisonerAgent(); var prisonerAgent1 = new TitForTatPrisonerAgent(); var prisonerAgent2 = new TitForTatPrisonerAgent(); env.Add(prisonerAgent1, "p1-" + prisonerAgent1.GetType().Name); prisonerAgent1.Start(); env.Add(prisonerAgent2, "p2-" + prisonerAgent2.GetType().Name); prisonerAgent2.Start(); Thread.Sleep(100); var policeAgent = new PoliceAgent(); env.Add(policeAgent, "police"); policeAgent.Start(); env.WaitAll(); }