public void SimulateTournament() { var p1 = new TennisPlayer("Morten", "Fredsøe", "Mølgaard", new DateTime(1993, 07, 21), "Dansk", TennisPlayer.Gender.Mand); var p2 = new TennisPlayer("Simon", "van Deurs", "Brix", new DateTime(1993, 10, 24), "Dansk", TennisPlayer.Gender.Mand); var p3 = new TennisPlayer("Hans", "Peter", "Jensen", new DateTime(1993, 10, 24), "Dansk", TennisPlayer.Gender.Mand); var p4 = new TennisPlayer("Mikkel", "Olsen", "Lang", new DateTime(1993, 10, 24), "Dansk", TennisPlayer.Gender.Mand); var p5 = new TennisPlayer("Rune", "Gammel", "Høj", new DateTime(1993, 10, 24), "Dansk", TennisPlayer.Gender.Mand); var p6 = new TennisPlayer("Carsten", "Bruun", "Vestergaard", new DateTime(1993, 10, 24), "Dansk", TennisPlayer.Gender.Mand); var p7 = new TennisPlayer("Jakob", "J.", "Jakobsen", new DateTime(1993, 10, 24), "Dansk", TennisPlayer.Gender.Mand); var p8 = new TennisPlayer("Anders", "A.", "Andersen", new DateTime(1993, 10, 24), "Dansk", TennisPlayer.Gender.Mand); var team1 = new Team(p1); var team2 = new Team(p2); var team3 = new Team(p3); var team4 = new Team(p4); var team5 = new Team(p5); var team6 = new Team(p6); var team7 = new Team(p7); var team8 = new Team(p8); var tourn1 = new Tournament("Wimbledon", 2015, new DateTime(2015, 01, 15), new DateTime(2015, 02, 15), 8); tourn1.AddPlayer(team1); tourn1.AddPlayer(team2); tourn1.AddPlayer(team3); tourn1.AddPlayer(team4); tourn1.AddPlayer(team5); tourn1.AddPlayer(team6); tourn1.AddPlayer(team7); tourn1.AddPlayer(team8); tourn1.PlayTournament(); }
public Team(TennisPlayer p1, TennisPlayer p2) { player1 = p1; player2 = p2; }
public Team(TennisPlayer p1) { player1 = p1; }
public void CheckGender() { TennisPlayer player1 = team1.ReturnP1(); TennisPlayer player2 = team1.ReturnP2(); TennisPlayer player3 = team2.ReturnP1(); TennisPlayer player4 = team2.ReturnP2(); if (MatchType == Type.WomSing) { if (player1.PersonGender == TennisPlayer.Gender.Kvinde && player3.PersonGender == TennisPlayer.Gender.Kvinde) { Console.WriteLine("Match is legal!"); } else { Console.WriteLine("Match is not legal!"); } } else if (MatchType == Type.MenSing) { if (player1.PersonGender == TennisPlayer.Gender.Mand && player3.PersonGender == TennisPlayer.Gender.Mand) { Console.WriteLine("Match is legal!"); } else { Console.WriteLine("Match is not legal!"); } } else if (MatchType == Type.WomDoub) { if (player1.PersonGender == TennisPlayer.Gender.Kvinde && player2.PersonGender == TennisPlayer.Gender.Kvinde && player3.PersonGender == TennisPlayer.Gender.Kvinde && player4.PersonGender == TennisPlayer.Gender.Kvinde) { Console.WriteLine("Match is legal!"); } else { Console.WriteLine("Match is not legal!"); } } else if (MatchType == Type.MenDoub) { if (player1.PersonGender == TennisPlayer.Gender.Mand && player2.PersonGender == TennisPlayer.Gender.Mand && player3.PersonGender == TennisPlayer.Gender.Mand && player4.PersonGender == TennisPlayer.Gender.Mand) { Console.WriteLine("Match is legal!"); } else { Console.WriteLine("Match is not legal!"); } } else if (MatchType == Type.MixDoub) { if (player1.PersonGender != player2.PersonGender && player3.PersonGender != player4.PersonGender) { Console.WriteLine("Match is legal!"); } else { Console.WriteLine("Match is not legal!"); } } }