Package game

Examples of game.Card


   */
  public void testCheckingForMatch()
  {
    assertFalse(state.checkForMatch(p1, p2));
    ArrayList<Card> list = new ArrayList<Card>();
    List<Card> l = Arrays.asList(new Card[] {new Card(14, 'c'), new Card(14, 'd'), new Card(14, 'h'), new Card(14, 's')});
    list.addAll(l);
    p1.getHand().addCards(list);
    assertTrue(state.checkForMatch(p1, p2));
  }
View Full Code Here


  public void askForCard(GoFish gofish, Player player, Player computer, int value)
  {
    boolean exchange = false;
    for (int i = 0; i < player.getHand().getSize(); i++)
    {
      Card card = player.getHand().getCard(i);
      if (card.getValue() == value)
      {
        computer.getHand().addCard(card);
        player.getHand().removeCard(i);
        exchange = true;
        i--;
View Full Code Here

  public void askForCard(GoFish gofish, Player player, Player computer, int value)
  {
    boolean exchange = false;
    for (int i = 0; i < computer.getHand().getSize(); i++)
    {
      Card card = computer.getHand().getCard(i);
      if (card.getValue() == value)
      {
        player.getHand().addCard(card);
        computer.getHand().removeCard(i);
        exchange = true;
        i--;
View Full Code Here

     * playerNormalDraw tells the given player to draw their next card
     * @param playerNum The player whose turn it is, 0 for player 1; 1 for player 2
     */
    protected void playerNormalDraw(int playerNum)
    {
        Card currCard = players.get(playerNum).takeTurn();
        previousCard = currCard;
        placeCard(playerNum, currCard);

        if (playerNum == 0)
        {
View Full Code Here

     * Tells the player to pick their next card to play
     * @return The next to to be played
     */
    public Card takeTurn()
    {
        Card nextCard = cheat();
        return nextCard;
    }
View Full Code Here

     * Tells the player to pick the next 3 cards, if able, for a war.
     * @return
     */
    public Card[] war()
    {
        Card tmp[] = new Card[3];
        int warCards = 3;
        if (getHand().getSize() <= 3)
        {
            warCards = getHand().getSize()-1;
        }
View Full Code Here

  //increments cardsDealt
  @Override
  public void executeCommand(BlackJackTable bj)
  {
    int pos = (int)Math.random()*51;
    Card c = bj.getDeck().getCard(pos);
    if(c==null)
    {
      executeCommand(bj);
    }
    else
View Full Code Here

  //if card is null, recalls itself until card is found
  @Override
  public void executeCommand(BlackJackTable bj)
  {
    int pos = (int)Math.random()*51;
    Card c = bj.getDeck().getCard(pos);
    if(c==null)
    {
      executeCommand(bj);
    }
    else
View Full Code Here

    {
        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

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.