Package hand

Examples of hand.Hand


    {
        Card cd = new Card(7, 's');
        PlayerController.previousCard = cd;
       
        Cheating cheat = new Cheating();
        Hand hand = new Hand(10);
        //System.out.println(hand);
        ArrayList<Card> cards = new ArrayList<Card>();
        cards.add(new Card(6, 'c'));
        cards.add(new Card(5, 'c'));
        cards.add(new Card(10, 'c'));
        cards.add(new Card(8, 'c'));
        cards.add(new Card(1, 'c'));
        cards.add(new Card(3, 'c'));
        cards.add(new Card(7, 'c'));
        hand.addCards(cards);
       
        assertEquals(cards.get(3), cheat.getNextCard(hand));
    }
View Full Code Here


    public void testCheatingPrevCardNull()
    {
        PlayerController.previousCard = null;
       
        Cheating cheat = new Cheating();
        Hand hand = new Hand(10);
        //System.out.println(hand);
        ArrayList<Card> cards = new ArrayList<Card>();
        cards.add(new Card(6, 'c'));
        cards.add(new Card(5, 'c'));
        cards.add(new Card(10, 'c'));
        cards.add(new Card(8, 'c'));
        cards.add(new Card(1, 'c'));
        cards.add(new Card(3, 'c'));
        cards.add(new Card(2, 'c'));
        hand.addCards(cards);
       
        assertEquals(cards.get(0), cheat.getNextCard(hand));
    }
View Full Code Here

    {
        Card cd = new Card(10, 's');
        PlayerController.previousCard = cd;
       
        Cheating cheat = new Cheating();
        Hand hand = new Hand(10);
        //System.out.println(hand);
        ArrayList<Card> cards = new ArrayList<Card>();
        cards.add(new Card(6, 'c'));
        cards.add(new Card(5, 'c'));
        cards.add(new Card(10, 'c'));
        cards.add(new Card(8, 'c'));
        cards.add(new Card(1, 'c'));
        cards.add(new Card(3, 'c'));
        cards.add(new Card(2, 'c'));
        hand.addCards(cards);
       
        assertEquals(cards.get(2), cheat.getNextCard(hand));
    }
View Full Code Here

    {
        Card cd = new Card(12, 's');
        PlayerController.previousCard = cd;
       
        Cheating cheat = new Cheating();
        Hand hand = new Hand(10);
        //System.out.println(hand);
        ArrayList<Card> cards = new ArrayList<Card>();
        cards.add(new Card(6, 'c'));
        cards.add(new Card(5, 'c'));
        cards.add(new Card(10, 'c'));
        cards.add(new Card(8, 'c'));
        cards.add(new Card(1, 'c'));
        cards.add(new Card(3, 'c'));
        cards.add(new Card(2, 'c'));
        hand.addCards(cards);
       
        assertEquals(cards.get(0), cheat.getNextCard(hand));
    }
View Full Code Here

   * Computer checks for match
   */
  @Override
  public boolean checkForMatch(Player player, Player computer)
  {
    Hand h = computer.getHand();
    int matches;
    for (int i = 0; i < h.getSize(); i++)
    {
      matches = 1;
      for (int j = i + 1; j < h.getSize(); j++)
      {
        if (h.getCard(i).getValue() == h.getCard(j).getValue())
          matches++;
      }
      if (matches == 4)
        return true;
    }
View Full Code Here

   * The player checks for a match
   */
  @Override
  public boolean checkForMatch(Player player, Player computer)
  {
    Hand h = player.getHand();
    int matches;
    for (int i = 0; i < h.getSize(); i++)
    {
      matches = 1;
      for (int j = i + 1; j < h.getSize(); j++)
      {
        if (h.getCard(i).getValue() == h.getCard(j).getValue())
          matches++;
      }
      if (matches == 4)
        return true;
    }
View Full Code Here

     */
    @Test
    public void testNotCheating()
    {
        NotCheating cheat = new NotCheating();
        Hand hand = new Hand(10);
        //System.out.println(hand);
        ArrayList<Card> cards = new ArrayList<Card>();
        cards.add(new Card(6, 'c'));
        cards.add(new Card(5, 'c'));
        cards.add(new Card(10, 'c'));
        cards.add(new Card(8, 'c'));
        cards.add(new Card(1, 'c'));
        cards.add(new Card(3, 'c'));
        cards.add(new Card(2, 'c'));
        hand.addCards(cards);
       
        assertEquals(cheat.getNextCard(hand), cards.get(0));
    }
View Full Code Here

TOP

Related Classes of hand.Hand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.