Date post: | 19-Dec-2015 |
Category: |
Documents |
View: | 215 times |
Download: | 0 times |
Ikhan McClartyDevin GainesGraham Gimbert James CefarattiKwang Kim Monarch Shah
Exploration of Design Alternatives
Graphic User InterfaceIkhan McClarty
Confirmation boxes void confirmClose()
This method is called if the player chooses to close without saving and after the confirmation proceeds to close or gives the player the option to save
void confirmOverwiteSave() This method is called if the player chooses to save using
a filename that already exists It either cancels the command or proceeds to overwrite
the already present file
Confirmation boxes Cont’d void confirmLoadGame()
This method is called if there is a game currently in progress and the player asks to load a saved game
It then gives the player the option to load the game or cancel the request
Table FeaturesMonarch Shah
Table Features Functionality:
Includes ongoing action on the table Mainly it’s just a conversation bubble Bubble will pop next to the player Icon. Snap shot of this is shown below.
Different Kind’s of bubble includes Check, Raise, Fold, Call, Flop, Turn , River.
Shown Below:
Functionality: Going to Use C and Allegro for coding. Idea is whenever user select “check” button,
check bubble will pop up for particular player. Its going to communicate with all the buttons, and
going to respond accordingly. Only active when some particular action calls
them and respond to this action. Disabled Rest of the time.
Implementation: Table Features Class showBubble (playerName, selectedButton button); Interacts with both player and button so both
attributes are needed in this function. hideBubble (playerName, selectedButton button); Flop, turn and river bubbles are not associated with
player, they are associated with table so they will have table attributes.
Player/Player Icons: You can choose from 20 given Icons and
computer will be given icons randomly. It will Look something like this:
Computer Playing Intelligence
Kwang Kim
Function Implementation Each player has all the same functions in order
to play. These include call, bet, raise, fold, check, pre-
flop strategy, post-flop strategy. How to implement?
Implementation
Create a hierarchy of classes. Superclass is a general player, includes all the
functions. Function specifications are described in each
subclass: weak, tight, aggressive.
Function Specification
Functions which are used in each style.void preFlop() //execute preflop strategyvoid postFlop() //execute postflop strategyint getHandRanking(Hand h) //returns strength of a handvoid check() //do nothing, action passed to next player in
hand
Function Specification
void callBet(Bet b)
//call b amount of chips
void bet()
//bet fixed amount of chips
void raise(Bet b)
//bet b + fixed amount of chips
void fold()
//surrender hand
Function Specification
bool inHand()
//return true if player is in the hand
void showDown()
//show cards at showdown end of hand
void updateChips(int x)
//update chip count by x
int getChipCount()
//return number of chips player has
Implementation Plan Superclass has definitions for the following
functions: call, bet, raise, fold, check, getHandRanking, inHand, showDown, getChipCount, updateChips.
The only functions needed in the subclass are pre-flop and post-flop strategy.
Button FunctionalityJames Cefaratti
Button Class
class Button Public:
getX(); getY(); setX(int newX); setY(int newY); setSkin(BITMAP* putSkin);
Button Class (cont.)
Public: getHeight(); getWidth();
Point of Functions
Should be able to move the button anywhere on the screen using the setX and setY
Should be able to get the button’s x and y coordinates and the height and width value to tell if the mouse is over the button
If the mouse is over the button and the mouse button is pressed, another function can be called
Save/Load Feature
This will be a function in the main class that stores information about the current game and saves it / reads it from a file
When “Save Game” is clicked on the screen the current game values such as player name, player chip count, button holder, pot size, etc… will be saved to an array or arrays
saveGame Signature
void saveGame(String[] names, int[] values) Save to a file in some logical order
loadGame Signature
First the game screen will have to be loaded and setup then function should be called to setup the game exactly how it was
Void loadGame() Read values in from the file, the order of the values is
known so the game can be setup corresponding to those values
Sample Player Data File
James 5 10,000 True A, hearts ; A, spades
Player Name Position at table Player Chip Count Button Current Hand
Sample Computer Data John 1 500 false Jill 2 1000 false Ryan 3 2500 false Sarah 4 6000 False 500
Computer Player Name Position at Table Chip Count Button Computer Player Name Position at table Chip count Button Computer Player Name Position at Table Chip Count Button Computer Player Name Position at Table Chip Count Button Pot Size
Best Hand AlgorithmGraham Gimbert
Store and sort via a Bi-directional doubly-linked lists Using the lists check for things such as cards of equal
value, same suit, incrementing value, and high cards
class Cardnode
{
private:
Cardnode *next;
Cardnode *prev;
Cardnode *down;
Card *data;
public:
Cardnode* getNext();
Cardnode* getPrev();
Cardnode* getDown();
Card* getData();
void setNext(Cardnode *temp);
void setPrev(Cardnode *prev);
void setDown(Cardnode *temp);
Cardnode (Card *temp, Cardnode *tnext, Cardnode *tprev, Cardnode *tdown);
}
class Cardlist{
private:Cardnode *head;int size;
public:Cardnode* getHead();Cardnode* getNext(Cardnode *temp);Cardnode* getPrev(Cardnode *temp);Cardnode* getDown(Cardnode *temp);int getSize();void insert(Cardnode *temp);Cardlist();
}
class Hand{
private:Card *first;
public:void addCard(Card *temp);Card* getFirstCard();Card* getNextCard(Card *temp);Hand();
}
class BestHand{
private:Cardlist *numberList;Cardlist *suitList;Hand *receivedHand;Hand *bestHand;void parseNumbers();void parseSuits();
public:Hand* getBestHand();BestHand(Hand *toBeSorted);
}
Shuffling & AI Functions
Devin Gaines
Where to Begin… The main question that I am posing to this part of the
project is “what makes a good shuffling randomizer?” After tossing around a few ideas, some of the qualities needed for this shuffling program to work are…
Reliability of Randomness Is the function creating truly random numbers and are they
being nicely distributed among the cards? Efficiency of Code
Is the code efficient enough for the program not to lag? Repetitive of Randomization
Can this shuffling function be easily used during each hand?
Methods In Creating a Shuffling Function
Currently, I’m playing around with different randomization formats for the shuffling program.
One of the first ideas was developing a simple ordered deck. It seems fairly realistic in terms of the shuffling mechanism and it’s really clear cut as far as coding.
Random Ordered Shuffling
void shuffle(Card *playDeck) /*basic coding*/{
for(int i=0; i<52; i++) {
int j=rand() % 52; Card temp = playDeck[i]; playDeck[i] = playDeck[j]; playDeck[j] = temp;
} }
Advantages and Disadvantages This method is more traditional and simple in
coding. Also it allows for random numbers to be first produced and then cards are randomly placed in accordance to their random number.
The good thing about this type of code is that it allows for the shuffle to simulate how we, as humans, really shuffle. We do a simple swap to the cards in terms of positions. So
a top card might be then place towards the bottom of the deck or maybe somewhere in the middle, who knows?
The problem, though, with this idea is that it relies too heavily on randomizing technique, but it’s not entirely reliable as a good randomizer.
Another Method
Look Up Table This solution involves simple assigning a random number
to each card, and then picking cards out by random numbers.
There is a chance that two of the cards are assigned the same number. This can be checked each time you assign a number, or even better this can be checked when you sort the cards. If two cards are assigned to the same number, then one could either assign the next number or choose another random number to be assigned to the card.
This would form a lookup table each hand and have a card linked with a particular random number.
Look Up Method Functions
Assignment Function /*Assigning a random number to a certain card */Declare variables for DECK_SIZE and a CARD ID;Declare an array CARD_ASSIGNEDFrom 0 to DECK_SIZE
cardID = (rand()%DECK_SIZE); /* Get rand numbers between 0 and 51 */
if(cardID == any of the previous number in CARD_ASSIGNED array)
card1 = (rand()%DECK_SIZE);/*repeat finding a new number*/
elsewhen we find a new number, hold this number is CARD_ASSIGNED array and continue distributing the
rest of the numbers out.
Look Up Method Functions
Sorting Function (Bubble Sort) int flag = 1; // set flag to 1 to begin initial pass
From 0 to DECK_SIZE { flag = 0;
From 0 to DECK_SIZE – 1 if (random CardID x > random CardID y) {
Swap CardID in ascending orderflag = 1; // indicates that a swap occurred.
} } }
Look Up Method Functions
From here, all we would then need to do is have a ChooseRand() function to choose a random number for each player when picking a card at the beginning of each round.
Some of the benefit with this type of code would be the fact that we could easily pull information out at random.
The only problem with this method is when programming it we rely heavily on the rand() function for choosing a good random number. This is problematic because some random number generators like rand(), have bias on some of bits in a number. This makes the rand() function semi-predictable.
Look Up Method
A possible solution…I’m still playing around with that. But I’m looking into playing with weighted arrays and random functions to see if that makes the rand() function less predictable.
AI Functions
I’m also working on part of the AI player functions for one of template styles that the players will be going up against.
I’m personally in charge of the weak style strategy and I been contemplating a few ideas for a few functions needed to create this player style.
Player Modules
I want to make the function very much related to how actual players would take in and process information, so I will most likely use the following function… STIMULUS() //Defines the weak player’s betting style…when
they’ll be likely to raise or fold
RESPONSE() //A response to a player’s action in the game
JUDGE_WEAK() //A statistical function that takes in the stimulus and formulates whether the player should bet, how much they should bet, or if to fold.
STATS_WEAK() //Function carries all the likelihoods that they will bet, fold, raise, etc.