Blackjack

com.amoebacode.blackjack.strategy
Class BasicStrategyServer

java.lang.Object
  |
  +--com.amoebacode.blackjack.strategy.BasicStrategyServer

public class BasicStrategyServer
extends java.lang.Object

BasicStrategyServer responds to SOAP RPC-based requests from the client and calculates proper basic strategy decisions.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  HardStrategy hardStrategy
          The matrix of correct strategy decisions for hard hands
private  IHouseRules houseRules
          The set of casino options
private  PairStrategy pairStrategy
          The matrix of correct strategy decisions for pair hands
private  SoftStrategy softStrategy
          The matrix of correct strategy decisions for soft hands
 
Constructor Summary
BasicStrategyServer()
          Default public constructor.
 
Method Summary
private  void checkArguments(java.lang.String[] args)
          Validates the set of arguments received from the SOAP client.
private  CorrectAction getCorrectAction(BasicStrategyHand bsh, int dealerScore)
          Returns the appropriate correct action object for the specified player hand and dealer score.
 java.lang.String getCorrectAction(java.lang.String[] args)
          Responds to the SOAP RPC-based get correct action request by validating the arguments and returning the correct playing decision.
private  java.lang.String getCorrectActionDisplay(CorrectAction ca)
          Returns the appropriate correct action display message for the specified correct action object.
private  void setStrategy()
          Sets the various matrices of correct strategy decisions based on the selected casino options.
private  void updateOptions(java.lang.String arg)
          Updates the casino options based on the specified argument sent from the SOAP client.
private  void updateOptions(java.lang.String[] args)
          Updates the casino options based on the arguments sent from the SOAP client.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

houseRules

private IHouseRules houseRules
The set of casino options

pairStrategy

private PairStrategy pairStrategy
The matrix of correct strategy decisions for pair hands

hardStrategy

private HardStrategy hardStrategy
The matrix of correct strategy decisions for hard hands

softStrategy

private SoftStrategy softStrategy
The matrix of correct strategy decisions for soft hands
Constructor Detail

BasicStrategyServer

public BasicStrategyServer()
Default public constructor.
Parameters:
houseRules - the set of casino options
Method Detail

getCorrectAction

public java.lang.String getCorrectAction(java.lang.String[] args)
Responds to the SOAP RPC-based get correct action request by validating the arguments and returning the correct playing decision.
Parameters:
args - the array of arguments from the SOAP client
Returns:
the correct playing decision

setStrategy

private void setStrategy()
Sets the various matrices of correct strategy decisions based on the selected casino options.

updateOptions

private void updateOptions(java.lang.String[] args)
Updates the casino options based on the arguments sent from the SOAP client.
Parameters:
args - the array of arguments from the SOAP client

updateOptions

private void updateOptions(java.lang.String arg)
Updates the casino options based on the specified argument sent from the SOAP client.
Parameters:
args - the array of arguments from the SOAP client

getCorrectActionDisplay

private java.lang.String getCorrectActionDisplay(CorrectAction ca)
Returns the appropriate correct action display message for the specified correct action object.
Parameters:
ca - the correct action object
Returns:
a user-displayable correct action message

checkArguments

private void checkArguments(java.lang.String[] args)
                     throws java.lang.IllegalArgumentException
Validates the set of arguments received from the SOAP client.
Parameters:
args - the array of arguments from the SOAP client
Throws:
throws - an IllegalArgumentException if the arguments are invalid

getCorrectAction

private CorrectAction getCorrectAction(BasicStrategyHand bsh,
                                       int dealerScore)
Returns the appropriate correct action object for the specified player hand and dealer score.
Parameters:
bsh - the player's hand
dealerScore - the score of the dealer's hand
Returns:
the appropriate correct action object

Blackjack

Copyright © 2002 amoebacode.com.