static void Main(string[] args) { Trainer trainer1 = new Trainer(new Monkey("1")); Trainer trainer2 = new Trainer(new Monkey("2")); Spectator spectator = new Spectator(); trainer1.Init(); trainer2.Init(); for (int i = 0; i < 5; i++) { trainer1.PerformTrick(i, (trick) => TrickReaction(trick, spectator)); trainer2.PerformTrick(i, (trick) => TrickReaction(trick, spectator)); } }
static void TrickReaction(Trick trick, Spectator spectator) { ReactionType reaction = spectator.ReactToTrick(trick.TrickType); Console.WriteLine("Le spectateur {0} au tour {1} {2} du singe {3}", reaction.ToString(), trick.TrickType.ToString(), trick.TrickName, trick.TrickPerformer.GetName()); }