extmodule
Class ExtProposalMC

java.lang.Object
  extended by extmodule.ExtProposalMC
All Implemented Interfaces:
IF_ExtModule_Feed, IF_ExtModule_GetProposal

public class ExtProposalMC
extends java.lang.Object
implements IF_ExtModule_GetProposal

This class is a wrapper class to use the shared library MC.
It converts specified interface for external proposals into the protocol the library expects.

Author:
Witthold/Korol

Field Summary
private  int[] bets
           
private  java.util.ArrayList<Card> boardCards
           
private  int[] cashs
           
private  boolean dealer
           
private  java.util.ArrayList<ActionMC> handHistory
           
private  Card[][] holeCards
           
 
Constructor Summary
ExtProposalMC()
           
 
Method Summary
private  int convertCard(Card card)
          Returns the given card converted into another format.
private  int convertCard(int suit, int rank)
          Returns the given card converted into another format.
 int getBoardCard(int i)
          Returns the board card revealed as the indexed card.
private  int getNextAction(int player2_chips, boolean dealer)
           
 int getNumActions()
          Returns the amount of actions in the gameStorage.
 int getNumBoardCards()
          Returns the amount of board cards.
 char getOption(int i)
          Returns the type of the move with the given index.
 int getProposal()
          Returns the proposal for an action.
 int getValue(int i)
          Returns the value of the move with the given index.
private  boolean init()
           
 boolean initModule(int[] betSizes, int[] betStructure, int[] blindStructure, int ante, java.lang.String playerNames, int[] cashOfPlayer)
          Tries to initialize the module.
 void newAction(Action action)
          Informs the module about a new action.
 void newHand(int button)
          Informs the module about the beginning of a new hand.
 void newHoleCards(int player, int[] cardsAsInt)
          Informs the module about new hole cards of a player.
 void newRound(int round, int[] newCards)
          Informs the module about a new round.
private  void setCards(int c1, int c2)
           
private  void setChips(int init_cash)
           
 void showdown(int player, int gain)
          Informs the module about the showdown of the hand.
private  void showResult(boolean dealer, int card1, int card2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handHistory

private java.util.ArrayList<ActionMC> handHistory

holeCards

private Card[][] holeCards

boardCards

private java.util.ArrayList<Card> boardCards

cashs

private int[] cashs

bets

private int[] bets

dealer

private boolean dealer
Constructor Detail

ExtProposalMC

public ExtProposalMC()
Method Detail

init

private boolean init()

setChips

private void setChips(int init_cash)

setCards

private void setCards(int c1,
                      int c2)

showResult

private void showResult(boolean dealer,
                        int card1,
                        int card2)

getNextAction

private int getNextAction(int player2_chips,
                          boolean dealer)

initModule

public boolean initModule(int[] betSizes,
                          int[] betStructure,
                          int[] blindStructure,
                          int ante,
                          java.lang.String playerNames,
                          int[] cashOfPlayer)
Description copied from interface: IF_ExtModule_Feed
Tries to initialize the module.

Specified by:
initModule in interface IF_ExtModule_Feed
betStructure - The limits for each betting round (0 for no limit)
blindStructure - The blind sizes for the players after the button
ante - The ante for each player
playerNames - The player names in the table order. The name at index 0 is the own name
cashOfPlayer - The initial cash of the players.
Returns:
The success of initializing the module (Is the module able to deal with the limits, blinds, antes, amount of players,...)

newHand

public void newHand(int button)
Description copied from interface: IF_ExtModule_Feed
Informs the module about the beginning of a new hand.

Specified by:
newHand in interface IF_ExtModule_Feed

newHoleCards

public void newHoleCards(int player,
                         int[] cardsAsInt)
Description copied from interface: IF_ExtModule_Feed
Informs the module about new hole cards of a player.

Specified by:
newHoleCards in interface IF_ExtModule_Feed

newAction

public void newAction(Action action)
Description copied from interface: IF_ExtModule_Feed
Informs the module about a new action.

Specified by:
newAction in interface IF_ExtModule_Feed

newRound

public void newRound(int round,
                     int[] newCards)
Description copied from interface: IF_ExtModule_Feed
Informs the module about a new round.

Specified by:
newRound in interface IF_ExtModule_Feed

showdown

public void showdown(int player,
                     int gain)
Description copied from interface: IF_ExtModule_Feed
Informs the module about the showdown of the hand.

Specified by:
showdown in interface IF_ExtModule_Feed

getProposal

public int getProposal()
Description copied from interface: IF_ExtModule_GetProposal
Returns the proposal for an action.

Specified by:
getProposal in interface IF_ExtModule_GetProposal

getNumActions

public int getNumActions()
Returns the amount of actions in the gameStorage.


getOption

public char getOption(int i)
Returns the type of the move with the given index.

Parameters:
i - index of the move
Returns:
type of move as char

getValue

public int getValue(int i)
Returns the value of the move with the given index.

Parameters:
i - index of the move
Returns:
value of the move

getNumBoardCards

public int getNumBoardCards()
Returns the amount of board cards.

Returns:
amount of board cards

getBoardCard

public int getBoardCard(int i)
Returns the board card revealed as the indexed card.


convertCard

private int convertCard(Card card)
Returns the given card converted into another format.


convertCard

private int convertCard(int suit,
                        int rank)
Returns the given card converted into another format.