Ejemplo n.º 1
0
		public static void Main (string[] args)
		{
			new Deck ();

			List<Card> cards = new List<Card> ();
			foreach (Rank r in Enum.GetValues(typeof(Rank))) {
				foreach (Suit s in Enum.GetValues(typeof(Suit))) {
					cards.Add (new Card (s, r));
				}
			}

			GameLogic logic = new GameLogic ();
			bool yes = logic.getRoyalFlush (cards.Where (c => c.Suit == Suit.Club)).Any ();
			Console.WriteLine ("{0}", yes);

			bool count = logic.getRoyalFlush (cards.Where (c => c.Suit == Suit.Diamond && c.Rank != Rank.Ace)).Any ();
			Console.WriteLine ("{0}", count);

			foreach (var item in logic.getRoyalFlush (cards)) {
				foreach (var cards2 in item) {
					Console.Write ("({0}, {1}), ", cards2.Rank, cards2.Suit);
				}
				Console.WriteLine ();
			}

			bool thing = logic.getTripple (new List<Card> () {
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.Ten),
				new Card (Suit.Club, Rank.Ten),
			}).Any ();

			Console.WriteLine ("{0}", thing);

			bool straight = logic.getStraight (new List<Card> () {
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.King),
				new Card (Suit.Club, Rank.Jack),
				new Card (Suit.Club, Rank.Queen),
				new Card (Suit.Club, Rank.Ten),
			}).Any ();

			Console.WriteLine ("straight {0}", straight);

			int countStraight = logic.getStraight (new List<Card> () {
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.Two),
				new Card (Suit.Club, Rank.Two),
				new Card (Suit.Club, Rank.Three),
				new Card (Suit.Club, Rank.Three),
				new Card (Suit.Spade, Rank.Four),
				new Card (Suit.Club, Rank.Five),
			}).Count ();

			Console.WriteLine ("straight {0}", countStraight);

			bool fullHouse = logic.getFullHouse (new List<Card> () {
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.Ten),
				new Card (Suit.Club, Rank.Ten),
			}).Any ();

			Console.WriteLine ("fullHouse {0}", fullHouse);

			bool straightFlush = logic.getStraightFlush (new List<Card> () {
				new Card (Suit.Club, Rank.Ace),
				new Card (Suit.Club, Rank.King),
				new Card (Suit.Club, Rank.Queen),
				new Card (Suit.Club, Rank.Ten),
				new Card (Suit.Club, Rank.Jack),
			}).Any ();

			Console.WriteLine ("straightFlush {0}", straightFlush);

			Console.WriteLine ("Hello World!");
			Console.Read ();
		}