Package uk.co.iscoding.freecell.cards

Examples of uk.co.iscoding.freecell.cards.PlayingCard


        if (cards.size() == 0) {
            if (startingRank != StartingRank.ANY && card.getRank() != startingRank.rank) return false;
            if (startingSuit != StartingSuit.ANY && card.getSuit() != startingSuit.suit) return false;
        } else {
            PlayingCard topCard = getTopCard();

            int rankDifference = card.rankDifference(topCard);
            if (cycleMode == Cycle.CAN && Math.abs(rankDifference) == 12) rankDifference += 13 * rankMode.factor;
            if (rankMode != RankOrder.ANY && rankDifference != rankMode.factor) return false;

View Full Code Here


        }

        if (numCards == 1) {
            clone.moveSequence.add(String.format("Move %s from %s to %s", from.getTopCard(), from, to));
        } else {
            PlayingCard topOfMovedPile = from.getTopCards(numCards).getBottomCard();
            if (numCards == 2) {
                clone.moveSequence.add(String.format("Move %s and 1 other card from %s to %s", topOfMovedPile, from, to));
            } else {
                clone.moveSequence.add(String.format("Move %s and %d other cards from %s to %s", topOfMovedPile, numCards - 1, from, to));
            }
View Full Code Here

        assertEquals("Joker card name is correct", "Joker", JOKER.toString());
    }

    @Test
    public void testDeepClone() {
        PlayingCard clone = FIVE_OF_DIAMONDS.deepClone();
        assertTrue("Clone is equivalent card", FIVE_OF_DIAMONDS.equals(clone));
        assertFalse("Clone is not the same card", FIVE_OF_DIAMONDS == clone);
    }
View Full Code Here

        assertFalse("Clone is not the same card", FIVE_OF_DIAMONDS == clone);
    }

    @Test
    public void testEquals() {
        assertTrue("Equivalent cards are equal", FIVE_OF_DIAMONDS.equals(new PlayingCard(Suit.DIAMONDS, Rank.FIVE)));
        assertFalse("Non equivalent cards are not equal", KING_OF_CLUBS.equals(FIVE_OF_DIAMONDS));
        assertFalse("Joker is not equivalent to normal card", NINE_OF_DIAMONDS.equals(JOKER));
        assertTrue("Joker is equivalent to another Joker", JOKER.equals(new PlayingCard(Suit.JOKER, Rank.JOKER)));
    }
View Full Code Here

TOP

Related Classes of uk.co.iscoding.freecell.cards.PlayingCard

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.