Package game

Examples of game.Card


  @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

    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());
        String properOutPlayer1 = "0-c";
        String properOutPlayer2 = "0-c \t\t1-c\n";

        pc.placeCard(0, new Card(0, 'c'));
        assertEquals(properOutPlayer1, outContent.toString());

        pc.placeCard(1, new Card(1, 'c'));
        assertEquals(properOutPlayer2, outContent.toString());
    }
View Full Code Here

    @Test
    public void testFindWinner()
    {
        PlayerController pc = new PlayerController(new Cheating(), new Cheating());

        pc.player1Card = new Card(10, 'c');
        pc.player2Card = new Card(1, 'c');

        assertEquals(0, pc.findWinner());

        pc.player1Card = new Card(1, 'c');
        pc.player2Card = new Card(10, 'c');

        assertEquals(1, pc.findWinner());
    }
View Full Code Here

TOP

Related Classes of 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.