Beispiel #1
0
		// parameters: card, and an int: 0 = mycard1, 1 = mycard2, 2 = mycard3, 3 = mycard4.
		// 4 = housecard1, 5 = housecard2, 6 = housecard3, 7 = housecard4
		public Card aceTest(Card card, int which)
		{
			Console.Out.WriteLine ("Ace test: which: " + which + ". " + card.getRank () + " of " + card.getSuit ());
			// first some error handling
			if(which < 0 || which > 7)
			{
				Console.Out.WriteLine("AceTest: Not a real card.");
				return card;
			}

			// now set it to an 11 and update the count
			card.setNumericalRank (11);
			updateCount ();

			// see if an 11 will bust
			if(which == 0 || which == 1 || which == 2 || which == 3)
			{
				if(checkBust())
				{
					card.setNumericalRank (1);
				}
			}
			else if(which == 4 || which == 5 || which == 6 || which == 7)
			{
				if(checkHouseBust())
				{
					card.setNumericalRank (1);
				}
			}
			Console.Out.WriteLine("ace test final result: which: " + which + ". " + card.getRank () + " of " + card.getSuit ());
			return card;
		}