Jadex 0.96

jadex.examples.blackjack
Class CardSet

java.lang.Object
  extended by jadex.examples.blackjack.CardSet

public class CardSet
extends Object

This class represents a whole blackjack-cardSet. Blackjack-cardSets are usually composed of 6 'normal' cardSets, each containing 52 cards.


Field Summary
static String ACE
           
static String CLUB
           
static String DIAMOND
           
static String HEART
           
static String JACK
           
static String KING
           
static int NUMBER_CARDS
           
static int NUMBER_PACKS
           
static String QUEEN
           
static String SPADE
           
 
Constructor Summary
CardSet()
          Cards have to be encoded as Strings, cause they are being sent as a message's content and only Strings are allowed as the content-objects of ACLMessages (exceptions are Predicates and Actions, but these are ontology-specific objects)
 
Method Summary
static int calculateDeckValue(Card[] cards)
          This method calculates the overall value of a cardSet.
 Card drawCard()
          This method returns a randomly chosen card from the cardSet.
 String toString()
          Create a string representation of the card set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NUMBER_PACKS

public static final int NUMBER_PACKS
See Also:
Constant Field Values

NUMBER_CARDS

public static final int NUMBER_CARDS
See Also:
Constant Field Values

JACK

public static final String JACK
See Also:
Constant Field Values

QUEEN

public static final String QUEEN
See Also:
Constant Field Values

KING

public static final String KING
See Also:
Constant Field Values

ACE

public static final String ACE
See Also:
Constant Field Values

DIAMOND

public static final String DIAMOND
See Also:
Constant Field Values

HEART

public static final String HEART
See Also:
Constant Field Values

SPADE

public static final String SPADE
See Also:
Constant Field Values

CLUB

public static final String CLUB
See Also:
Constant Field Values
Constructor Detail

CardSet

public CardSet()
Cards have to be encoded as Strings, cause they are being sent as a message's content and only Strings are allowed as the content-objects of ACLMessages (exceptions are Predicates and Actions, but these are ontology-specific objects)

Method Detail

drawCard

public Card drawCard()
This method returns a randomly chosen card from the cardSet.

Returns:
randomly chosen card, encoded as a String-object.

calculateDeckValue

public static int calculateDeckValue(Card[] cards)
This method calculates the overall value of a cardSet. The only thing to be mentioned is, that aces may count as 1 or 11, and that there is no way to influence this. Aces count 11 as long as the overAll deckValue is beneath 21. Only in case the overAll value lies above 21 and there are aces present, one (or more) aces count as a 1.


toString

public String toString()
Create a string representation of the card set.

Overrides:
toString in class Object
Returns:
A string representation of the card set.

Jadex 0.96

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.