de.uni_paderborn.robots.robotArenaInterface
Class CardData

java.lang.Object
  |
  +--de.uni_paderborn.robots.robotArenaInterface.ItemData
        |
        +--de.uni_paderborn.robots.robotArenaInterface.CardData
All Implemented Interfaces:
CardConstants, java.lang.Cloneable, java.lang.Comparable

public final class CardData
extends ItemData
implements java.lang.Comparable, java.lang.Cloneable, CardConstants

This class contains the necessary information to identify a card. This class is used in two ways: (1) as attribute of "RobotData" ( parameter of "getCommand" ) to provide the robot with his current hand of cards (2) as attribute of PutAction or ExchangeAction if the robot wants to put a card down or exchange it with another one in front of him made class final to allow no futher changes by groups nearly complete


Fields inherited from interface de.uni_paderborn.robots.robotArenaInterface.CardConstants
ACE, CLUB, DIAMOND, EIGHT, FIVE, FLUSH, FOUR, FOUR_OF_A_KIND, FULL_HOUSE, HEART, JACK, KING, LADY, NINE, NOTHING, ONE_PAIR, ROYAL_FLUSH, SEVEN, SIX, SPADE, STRAIGHT, STRAIGHT_FLUSH, TEN, THREE, THREE_OF_A_KIND, TWO, TWO_PAIRS
 
Constructor Summary
CardData(byte color, byte value)
          constructor used to create a card which a element of the hand of the robot. a robot should NEVER create a card !!!
 
Method Summary
static CardData[] cardSort(CardData[] cards)
           
 java.lang.Object clone()
          returns a reference to a cloned CardData
 int compareTo(java.lang.Object o)
          used to compara two cards see Comparable for return value definition a.compareTo(b) is negative for a < b 0 for a == b positive for a > b
 byte getColor()
          returns a value between 1 and 4 : constant value DIAMOND = 1 (german: Karo) HEART = 2 (german: Herz) SPADE = 3 (german: Pik) CLUB = 4 (german: Kreuz)
static int getHandValue(CardData[] hand)
           
 byte getValue()
          returns a value between 2 and 14 : constant value TWO = 2 (german: Zwei) THREE = 3 (german: Drei) FOUR = 4 (german: Vier) FIVE = 5 (german: Fünf) SIX = 6 (german: Sechs) SEVEN = 7 (german: Sieben) EIGHT = 8 (german: Acht) NINE = 9 (german: Neun) TEN = 10 (german: Zehn) JACK = 11 (german: Bube) LADY = 12 (german: Dame) KING = 13 (german: König) ACE = 14 (german: As)
static java.lang.String stringTypeOfScore(int score)
          returns the calculate type of score as a string
 java.lang.String toString()
          returns the string representation of the card
static int typeOfScore(int score)
          calculate type of score and returns it
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CardData

public CardData(byte color,
                byte value)
         throws java.lang.IllegalArgumentException
constructor used to create a card which a element of the hand of the robot. a robot should NEVER create a card !!! instead it should use the cards provided by the arena.
Method Detail

getColor

public byte getColor()
returns a value between 1 and 4 : constant value DIAMOND = 1 (german: Karo) HEART = 2 (german: Herz) SPADE = 3 (german: Pik) CLUB = 4 (german: Kreuz)

getValue

public byte getValue()
returns a value between 2 and 14 : constant value TWO = 2 (german: Zwei) THREE = 3 (german: Drei) FOUR = 4 (german: Vier) FIVE = 5 (german: Fünf) SIX = 6 (german: Sechs) SEVEN = 7 (german: Sieben) EIGHT = 8 (german: Acht) NINE = 9 (german: Neun) TEN = 10 (german: Zehn) JACK = 11 (german: Bube) LADY = 12 (german: Dame) KING = 13 (german: König) ACE = 14 (german: As)

compareTo

public int compareTo(java.lang.Object o)
used to compara two cards see Comparable for return value definition a.compareTo(b) is negative for a < b 0 for a == b positive for a > b
Specified by:
compareTo in interface java.lang.Comparable

clone

public java.lang.Object clone()
returns a reference to a cloned CardData
Overrides:
clone in class java.lang.Object

cardSort

public static CardData[] cardSort(CardData[] cards)

getHandValue

public static int getHandValue(CardData[] hand)

typeOfScore

public static int typeOfScore(int score)
calculate type of score and returns it

stringTypeOfScore

public static java.lang.String stringTypeOfScore(int score)
returns the calculate type of score as a string

toString

public java.lang.String toString()
returns the string representation of the card
Overrides:
toString in class java.lang.Object