001 /*
002 * Created on 25.02.2005 Filename: Rules.java
003 */
004 package jagafa.rule;
005
006 import jagafa.object.Board;
007 import jagafa.object.Card;
008 import jagafa.object.Hand;
009
010 /**
011 * Interface for defining a RuleSet (eg. Oben, Unten, Trumpf)
012 * All Methods have to be implemented
013 */
014 public interface RuleSet {
015
016 /* TODO: Add interface method for in-round rule change */
017
018 /**
019 * Gibt die bessere der beiden Karten zurück
020 * @return The card with the higher power
021 * @param c1 The first card
022 * @param c2 The second card
023 */
024 public abstract Card getHigherCard(Card c1, Card c2);
025
026 /**
027 * Check wether a card beats all the cards on a board given
028 * @param c1 The relevant card
029 * @param b The relevant board
030 * @return True, if the card specified beats all the cards in the Board
031 */
032 public boolean compareHigher(Card c1, Board b);
033
034
035 /**
036 * Liefert den Wert der Karte relativ zum liegenden Board
037 * @return The power of a card with respect to a Board
038 * @param c The relevant card
039 * @param b The relevant Board
040 */
041 public abstract int getPower(Card c, Board b);
042
043 /**
044 * Liefert den Punktewert der Karte
045 * @return The score of a card
046 * @param c The relevant card
047 */
048 public abstract int getScore(Card c);
049
050 /**
051 * Prüft die Gültigkeit der Karte bei gegebenem Board und Hand
052 * @return True, if the card is a valid play
053 * @param c The card to check
054 * @param h The hand holding the card
055 * @param b The Board on which the cards wants to played
056 */
057 public abstract boolean isValid(Card c, Hand h, Board b);
058
059 /**
060 * Liefert den internen Wert des Wertes der Karte bei gegebenem Board
061 * @return An internal Rank of the cards value compared to other cards on a board
062 * @param b The relevant board
063 * @param c The relevant card
064 */
065 public abstract int getValueRank(Card c, Board b);
066
067 /**
068 * Liefert den internen Wert der Farbe der Karte bei gegebenem Board
069 * @return An internal Rank of the cards color compared to other cards on a board
070 * @param b The relevant board
071 * @param c The relevant card
072 */
073 public abstract int getColorRank(Card c, Board b);
074
075 /**
076 * Liefert den Namen des RuleSet
077 * @return A String containing the name of the RuleSet
078 */
079 public abstract String getName();
080
081 /**
082 * Liefert die Spezialfarbe falls benötigt
083 * @return The color with a special role in the RuleSet
084 */
085 public abstract int specialColor();
086
087 /**
088 * Update the RuleSet after each turn (for automatic Changes)
089 */
090 public abstract void updateAfterTurn();
091 }