コード例 #1
0
ファイル: Hand_Test.java プロジェクト: phafycz/SpringBorgata
  @Test
  public void ThreeOfAKind_3() {
    Deck d = new Deck();
    Hand h = new Hand();
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.DIAMONDS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.SPADES, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.HEARTS, eRank.TWO, 0));
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.THREE, 0));
    h.EvalHand();

    assertTrue(h.getHandStrength() == eHandStrength.ThreeOfAKind.getHandStrength());
    assertTrue(h.getHighPairStrength() == eRank.TEN.getRank());
    assertTrue(h.getLowPairStrength() == 0);
    assertTrue(h.getKicker().size() == 2);

    Card c1 = h.getKicker().get(eCardNo.FirstCard.getCardNo());
    Card c2 = h.getKicker().get(eCardNo.SecondCard.getCardNo());

    //	Check to see if the first kicker is a THREE
    assertTrue(c1.getRank().getRank() == eRank.THREE.getRank());

    //	Check to see if the second kicker is a TWO
    assertTrue(c2.getRank().getRank() == eRank.TWO.getRank());
  }
コード例 #2
0
ファイル: Card.java プロジェクト: cknupp2009/Lab3
        public int compare(Card c1, Card c2) {

          int Cno1 = c1.getRank().getRank();
          int Cno2 = c2.getRank().getRank();

          /*For descending order*/
          return Cno2 - Cno1;
        }
コード例 #3
0
ファイル: Hand_Test.java プロジェクト: phafycz/SpringBorgata
  @Test
  public void HighCard() {
    Deck d = new Deck();
    Hand h = new Hand();
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.DIAMONDS, eRank.KING, 0));
    h.AddCardToHand(new Card(eSuit.SPADES, eRank.THREE, 0));
    h.AddCardToHand(new Card(eSuit.HEARTS, eRank.TWO, 0));
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.ACE, 0));
    h.EvalHand();

    assertTrue(h.getHandStrength() == eHandStrength.HighCard.getHandStrength());
    assertTrue(h.getHighPairStrength() == eRank.ACE.getRank());
    assertTrue(h.getLowPairStrength() == 0);
    assertTrue(h.getKicker().size() == 4);

    Card c1 = h.getKicker().get(eCardNo.FirstCard.getCardNo());
    Card c2 = h.getKicker().get(eCardNo.SecondCard.getCardNo());
    Card c3 = h.getKicker().get(eCardNo.ThirdCard.getCardNo());
    Card c4 = h.getKicker().get(eCardNo.FourthCard.getCardNo());

    //	Check value of kicker
    assertTrue(c1.getRank().getRank() == eRank.KING.getRank());

    //	Check value of kicker
    assertTrue(c2.getRank().getRank() == eRank.TEN.getRank());

    //	Check value of kicker
    assertTrue(c3.getRank().getRank() == eRank.THREE.getRank());

    //	Check value of kicker
    assertTrue(c4.getRank().getRank() == eRank.TWO.getRank());
  }
コード例 #4
0
ファイル: Deck.java プロジェクト: nhiggins31/Lab3
 public Deck(int numberOfJokers, ArrayList<Card> Wilds) {
   this(numberOfJokers);
   for (Card dCard : cards) {
     for (Card wCard : Wilds) {
       if (dCard.getSuit() == wCard.getSuit() && dCard.getRank() == wCard.getRank()) {
         dCard.setWild();
       }
     }
   }
 }
コード例 #5
0
ファイル: Hand_Test.java プロジェクト: phafycz/SpringBorgata
  @Test
  public void FourOfAKind_1() {
    Deck d = new Deck();
    Hand h = new Hand();
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.DIAMONDS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.SPADES, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.HEARTS, eRank.TEN, 0));
    h.AddCardToHand(new Card(eSuit.CLUBS, eRank.NINE, 0));
    h.EvalHand();

    assertTrue(h.getHandStrength() == eHandStrength.FourOfAKind.getHandStrength());
    assertTrue(h.getHighPairStrength() == eRank.TEN.getRank());
    assertTrue(h.getLowPairStrength() == 0);
    assertTrue(h.getKicker().size() == 1);

    Card c1 = h.getKicker().get(eCardNo.FirstCard.getCardNo());

    //	Check to see if the kicker is a NINE
    assertTrue(c1.getRank().getRank() == eRank.NINE.getRank());
  }
コード例 #6
0
ファイル: Deck.java プロジェクト: bhodges24/PS_3_Java
  public Deck(int NbrOfJokers, ArrayList<Card> WildCards) {

    this(NbrOfJokers); // Calls Single_Arg Constructor Deck(NbrOfJokers)

    for (Card deckCard : cards) {
      for (Card WildCard : WildCards) {
        if ((deckCard.getSuit() == WildCard.getSuit())
            && (deckCard.getRank() == WildCard.getRank())) {
          deckCard.setWild();
        }
      }
    }
    ShuffleCards();
  }