//Author: ^-^ Veerle ^-^ //Object representing a playing card import java.awt.*; public class solitareCard { private int colour = 0, rank = 0; private boolean isFaceDown = true, isBlack = true; private Image imgCard = null; public solitareCard (int colour, int rank, Image imgCard) { this.colour = colour; this.rank = rank; this.imgCard = imgCard; if (colour < 2) //If the colour is spade or club { isBlack = true; } else //If the colour is heart or diamond { isBlack = false; } } public int getColour () { return colour; } public int getRank () { return rank; } public boolean isFaceDown () { return isFaceDown; } //Checks a card that is being placed on this card in a column (must be different colour and one rank lower) public boolean checkLegalColumnMove (int cardBeingPlacedRank, boolean cardBeingPlacedIsBlack) { if (isBlack != cardBeingPlacedIsBlack && cardBeingPlacedRank == (rank - 1)) { return true; } else { return false; } } //Checks a card that is being placed ontop of this card in the ace holder (must be same colour and one rank higher) public boolean checkLegalAceMove (int cardBeingPlacedRank, int cardBeingPlacedColour) { if (cardBeingPlacedColour == colour && cardBeingPlacedRank == (rank + 1)) { return true; } else { return false; } } public boolean isBlack () { return isBlack; } public void setFaceDown (boolean isFaceDown) { this.isFaceDown = isFaceDown; } public Image getImg () { return imgCard; } }