public class ShieldedHand extends Object implements Hand
Created by webpigeon on 18/10/16.
Constructor and Description |
---|
ShieldedHand(Hand hand) |
Modifier and Type | Method and Description |
---|---|
void |
bindCard(int slot,
Card card)
Bind a card to a given slot, keeping all known information about it.
|
boolean |
equals(Object o) |
Card |
getCard(int slot)
Get the card really present in the slot (or null if unknown).
|
CardColour |
getKnownColour(int slot)
Get the known colour of this slot, from the perspective of the player who's hand it is.
|
Integer |
getKnownValue(int slot)
Get the known value of this slot, from the perspective of the player who's hand it is.
|
CardColour[] |
getPossibleColours(int slot)
get possible colours for a given slot.
|
int[] |
getPossibleValues(int slot)
get possible values for a given slot.
|
int |
getSize()
The number of cards which make up this hand.
|
boolean |
hasCard(int slot)
Does the hand contain a card in this slot?
|
boolean |
hasColour(CardColour colour)
Has a card of that colour that it knows exactly about
|
int |
hashCode() |
boolean |
hasValue(Integer value)
Has a card of that value that it knows exactly about
|
void |
init()
Initialise all information about the slots.
|
boolean |
isCompletePossible(int slot,
Card card)
Check if this card is possible based on complete infomation.
|
boolean |
isPossible(int slot,
Card card)
check if the card is possible, based on the owner's prespective
|
void |
setCard(int slot,
Card card)
Set a card in a given slot, removing all known information about it.
|
void |
setHasCard(int slot,
boolean value)
Sets whether the hand has a card in this slot.
|
void |
setKnownColour(CardColour colour,
Integer[] slots)
Sets the known colour of a slot from the perspective of the owner.
|
void |
setKnownValue(Integer value,
Integer[] slots)
Sets the known value of a slot from the perspective of the owner.
|
public ShieldedHand(Hand hand)
public void init()
Hand
This should reset any known infomation for any slot in the hand.
public Card getCard(int slot)
Hand
This is the card which is present in the slot based on information provided by the game itself. This method should always return null for your own hand (agents should not call this method on their own hands).
Agents can use this for accurate information about other player's hands.
public CardColour getKnownColour(int slot)
Hand
For this version of the hand class, this is worked out based on explicitly observed tell actions. It will not take into account negative information.
getKnownColour
in interface Hand
slot
- the slot to querypublic Integer getKnownValue(int slot)
Hand
For this version of the hand class, this is worked out based on explicitly observed tell actions. It will not take into account negative information.
getKnownValue
in interface Hand
slot
- the slot to querypublic int getSize()
Hand
This can very with game size, and so this should be used whenever you need to iterate over the number of slots in this player's hand.
public void setCard(int slot, Card card)
Hand
This should be called when a CardDrawn
event occurs in order
to update this hand with the correct information.
It will also reset all known information from the perspective of the owner.
public void bindCard(int slot, Card card)
Hand
This has the same basic role as Hand.setCard(int, com.fossgalaxy.games.fireworks.state.Card)
but will not remove any information from the owners perspective.
This is mostly useful when using this class as part of a simulation based agent to set the value of the card.
public void setKnownColour(CardColour colour, Integer[] slots)
Hand
This method is used to inform the hand about the card from the owner's perspective (tell actions).
setKnownColour
in interface Hand
colour
- the colour to assign to the slotsslots
- the slots to assign the colour to.public void setKnownValue(Integer value, Integer[] slots)
Hand
This method is used to inform the hand about the card from the owner's perspective (tell actions).
setKnownValue
in interface Hand
value
- the value to assign to the slotsslots
- the slots to assign the value to.public boolean isCompletePossible(int slot, Card card)
Hand
isCompletePossible
in interface Hand
slot
- the slot to checkcard
- the card we are consideringpublic boolean isPossible(int slot, Card card)
Hand
isPossible
in interface Hand
slot
- the slot to checkcard
- the card we are consideringpublic int[] getPossibleValues(int slot)
Hand
getPossibleValues
in interface Hand
slot
- the slot to checkpublic CardColour[] getPossibleColours(int slot)
Hand
getPossibleColours
in interface Hand
slot
- the slot to checkpublic boolean hasColour(CardColour colour)
Hand
public boolean hasValue(Integer value)
Hand
public boolean hasCard(int slot)
Hand
public void setHasCard(int slot, boolean value)
Hand
setHasCard
in interface Hand
slot
- The slot to setvalue
- The presence or not of a cardCopyright © 2017 FOSS Galaxy. All rights reserved.