Package Project1.Game

Examples of Project1.Game.Card


    {
        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


  @Test
  public void testSelection()
  {
    Memory.reset();
    Memory m = Memory.getInstance();
    m.setSelections(new Card(1, 'h'), new Card(2, 'd'));
    assertEquals("1-h", m.getSelectionOne().toString());
    assertEquals("2-d", m.getSelectionTwo().toString());
  }
View Full Code Here

  @Test
  public void testCreateBoard()
  {
    Memory.reset();
    Memory m = Memory.getInstance();
    Card currentCard;
    for(int i = 0; i < m.gameBoard.length; i++) // Current Card
    {
      for(int j = 0; j < m.gameBoard[i].length; j++)
      {
        currentCard = m.gameBoard[i][j];
View Full Code Here

  public void testCompareMemoryMatches()
  {
    Memory.reset();
    Memory m = Memory.getInstance();
   
    m.setSelections(new Card(1, 'h'), new Card(1, 'd')); // same value, different suits
    assertTrue(m.compareCards());
   
    m.setSelections(new Card(1, 'h'), new Card(1, 'c')); // same value, different color
    assertFalse(m.compareCards());
   
    m.setSelections(new Card(1, 'h'), new Card(2, 'd')); // different value, difference suit
    assertFalse(m.compareCards());
   
  }
View Full Code Here

  @Test
  public void Test_Winner()
  {
    BlackJackTable bj = new BlackJackTable();
    //Choose 3 cards
    Card c01 = bj.getDeck().getCard(1);
    Card c02 = bj.getDeck().getCard(2);
    Card c03 = bj.getDeck().getCard(4);
   
    //Test with each player having 1 card player wins
    bj.getDealer().getHand().add(c01);
    bj.getPlayer().getHand().add(c02);   
    assertEquals(1,bj.calculateWinner());
View Full Code Here

   * Test to make sure a specific card can be added
   */
  @Test
  public void testAddSpecificCard()
  {
    hand.addCard(new Card(10, 'h'));
    assertEquals(10, hand.getCard(0).getValue());
    assertEquals('h', hand.getCard(0).getSuit());
  }
View Full Code Here

   */
  public void testAddingMultipleCards()
  {
    hand.drawHand();
    ArrayList<Card> list = new ArrayList<Card>();
    list.addAll(Arrays.asList(new Card[] {new Card(9, 'd'), new Card(10, 'h')}));
    hand.addCards(list);
    assertTrue(hand.contains(new Card(9, 'd')));
    assertTrue(hand.contains(new Card(10, 'h')));
  }
View Full Code Here

    @Override
    public Card getNextCard(Hand currHand)
    {
        int index = (int) (Math.random() * currHand.getSize());
        Card nextCard = currHand.getCard(index);
        currHand.removeCard(index);
        return nextCard;
    }
View Full Code Here

{

    @Override
    public Card getNextCard(Hand currHand)
    {
        Card nextCard = currHand.getCard(0);
        currHand.removeCard(0);
        //System.out.println(currHand);
        return nextCard;
    }
View Full Code Here

{

    @Override
    public Card getNextCard(Hand currHand)
    {
        Card toBeat = PlayerController.previousCard;
        Card bestCard = null;
        int bestPos = 0;
        if (toBeat == null)
        {
            bestCard = currHand.getCard(0);
            bestPos = 0;
View Full Code Here

TOP

Related Classes of Project1.Game.Card

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.