smithers.cards
Class BuildingDownByAlternatingColours
java.lang.Object
smithers.cards.AbstractBuildingRule
smithers.cards.BuildingDownByAlternatingColours
- All Implemented Interfaces:
- BuildingRule
public class BuildingDownByAlternatingColours
- extends AbstractBuildingRule
A building rule which allows a card to be placed if it is the opposite
colour to, and one rank lower than, the top card.
Method Summary |
boolean |
goesInSpace(Card c)
Determines whether the specified card can be placed in an empty space. |
boolean |
goesOn(Card c1,
Card c2)
Determines whether card c2 can be placed on top of card c1 . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BuildingDownByAlternatingColours
public BuildingDownByAlternatingColours()
- Constructs a new instance of this rule. This uses the default, allowing
any card to be placed into an empty space.
BuildingDownByAlternatingColours
public BuildingDownByAlternatingColours(boolean startsWithKing)
- Constructs a new instance of this rule.
- Parameters:
startsWithKing
- true
iff only kings may be placed in
empty spaces
goesOn
public boolean goesOn(Card c1,
Card c2)
- Determines whether card
c2
can be placed on top of card c1
.
- Specified by:
goesOn
in class AbstractBuildingRule
- Parameters:
c1
- the card to move ontoc2
- the card to be moved
- Returns:
true
iff the card can be moved
goesInSpace
public boolean goesInSpace(Card c)
- Determines whether the specified card can be placed in an empty space.
- Specified by:
goesInSpace
in class AbstractBuildingRule
- Parameters:
c
- the card to be moved
- Returns:
true
iff the card can be moved into a space