Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of...

44
Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    214
  • download

    0

Transcript of Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of...

Page 1: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Ikhan McClartyDevin GainesGraham Gimbert James CefarattiKwang Kim Monarch Shah

Exploration of Design Alternatives

Page 2: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Graphic User InterfaceIkhan McClarty

Page 3: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 4: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 5: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Table FeaturesMonarch Shah

Page 6: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 7: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Different Kind’s of bubble includes Check, Raise, Fold, Call, Flop, Turn , River.

Shown Below:

Page 8: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 9: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 10: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Player/Player Icons: You can choose from 20 given Icons and

computer will be given icons randomly. It will Look something like this:

Page 11: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Computer Playing Intelligence

Kwang Kim

Page 12: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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?

Page 13: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 14: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 15: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 16: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 17: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 18: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Button FunctionalityJames Cefaratti

Page 19: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Button Class

class Button Public:

getX(); getY(); setX(int newX); setY(int newY); setSkin(BITMAP* putSkin);

Page 20: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Button Class (cont.)

Public: getHeight(); getWidth();

Page 21: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 22: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 23: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

saveGame Signature

void saveGame(String[] names, int[] values) Save to a file in some logical order

Page 24: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 25: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Sample Player Data File

James 5 10,000 True A, hearts ; A, spades

Player Name Position at table Player Chip Count Button Current Hand

Page 26: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 27: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Best Hand AlgorithmGraham Gimbert

Page 28: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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

Page 29: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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);

}

Page 30: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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();

}

Page 31: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

class Hand{

private:Card *first;

public:void addCard(Card *temp);Card* getFirstCard();Card* getNextCard(Card *temp);Hand();

}

Page 32: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

class BestHand{

private:Cardlist *numberList;Cardlist *suitList;Hand *receivedHand;Hand *bestHand;void parseNumbers();void parseSuits();

public:Hand* getBestHand();BestHand(Hand *toBeSorted);

}

Page 33: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

Shuffling & AI Functions

Devin Gaines

Page 34: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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?

Page 35: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 36: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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;

} }

Page 37: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 38: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 39: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 40: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

} } }

Page 41: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 42: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 43: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.

Page 44: Ikhan McClarty Devin Gaines Graham Gimbert James Cefaratti Kwang Kim Monarch Shah Exploration of Design Alternatives.

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.