Presentation is loading. Please wait.

Presentation is loading. Please wait.

Milestone 4 Devin Gaines Devin Gaines Graham Gimbert Graham Gimbert Ikhan Mcclarty Ikhan Mcclarty James Cefaratti James Cefaratti Kwang Kim Kwang Kim Monarch.

Similar presentations


Presentation on theme: "Milestone 4 Devin Gaines Devin Gaines Graham Gimbert Graham Gimbert Ikhan Mcclarty Ikhan Mcclarty James Cefaratti James Cefaratti Kwang Kim Kwang Kim Monarch."— Presentation transcript:

1 Milestone 4 Devin Gaines Devin Gaines Graham Gimbert Graham Gimbert Ikhan Mcclarty Ikhan Mcclarty James Cefaratti James Cefaratti Kwang Kim Kwang Kim Monarch Shah Monarch Shah

2 Graphics Ikhan Mcclarty Ikhan Mcclarty James Cefaratti James Cefaratti Monarch Shah Monarch Shah

3 Overview Of the major parts of the code able graphics, the button class is almost done. Of the major parts of the code able graphics, the button class is almost done. All of the graphics that we are going to use are already finished, barring unforseen problems. All of the graphics that we are going to use are already finished, barring unforseen problems. We will cover some of the more major parts to the buttons. We will cover some of the more major parts to the buttons.

4 Clicked bool Button::inButton() bool Button::inButton() { if( ( mouse_x >= getX() && mouse_x = getY() && mouse_y = getX() && mouse_x = getY() && mouse_y <= getBottom() ) ) { { return true; return true; } } else else { { return false; return false; } } } //This code stub is used to detect if the //mouse cursor is within the bounds of the //button. //This code stub is used to detect if the //mouse cursor is within the bounds of the //button.

5 Left Clicked bool Button::clicked() bool Button::clicked() { if( inButton() ) //This is the code to determine when a button is if( inButton() ) //This is the code to determine when a button is { //left clicked. Obviously this is going to be important { //left clicked. Obviously this is going to be important if( mouse_b & 1) //to the overall project, as buttons will guide when if( mouse_b & 1) //to the overall project, as buttons will guide when { //the game will advance. { //the game will advance. return true; return true; } } else else { { return false; return false; } } else else { { return false; return false; } } }

6 Draw Button void Button::drawButton(BITMAP *putSkin ) void Button::drawButton(BITMAP *putSkin ) { draw_sprite( screen, putSkin, getX(), getY() ); draw_sprite( screen, putSkin, getX(), getY() ); } //Draw button is also very important, as it //is what displays the button to the screen. //Draw button is also very important, as it //is what displays the button to the screen. //The actual function that gets called is //from the allegro graphical library. //The actual function that gets called is //from the allegro graphical library.

7 Correctness of Buttons Firstly, all of the get and set methods were tested with a console application to test that they were correct. Firstly, all of the get and set methods were tested with a console application to test that they were correct. Another major problem regarding correctness are filenames. Another major problem regarding correctness are filenames. If a filename is incorrect when trying to load, the program will crash. If a filename is incorrect when trying to load, the program will crash. Testing this was important. Testing this was important.

8 Correctness of Buttons The way we tested the correctness of the buttons was to set up a test program. The way we tested the correctness of the buttons was to set up a test program. In the test program, the button’s (x,y) position was always on the screen, as was the mouse’s (x,y) position. In the test program, the button’s (x,y) position was always on the screen, as was the mouse’s (x,y) position. By clicking all around and in the button while keeping track of all the clicks, we were able to determine that the buttons work properly By clicking all around and in the button while keeping track of all the clicks, we were able to determine that the buttons work properly

9 Correctness of Buttons With the Buttons and the file input working correctly, we were able to get the buttons to actually serve a purpose. With the Buttons and the file input working correctly, we were able to get the buttons to actually serve a purpose. We made it so that when a button is clicked, a file was written to. We made it so that when a button is clicked, a file was written to. After the test was finished, with text in the file, we knew that the buttons were fully functional. After the test was finished, with text in the file, we knew that the buttons were fully functional.

10 Integration The graphics are modular, to the point where integration will just be a matter of using the given classes The graphics are modular, to the point where integration will just be a matter of using the given classes There is nothing that has to be modified to work in the environment it was destined to. There is nothing that has to be modified to work in the environment it was destined to. The graphics front end will rely upon all of the other back end code being developed concurrently. The graphics front end will rely upon all of the other back end code being developed concurrently.

11 Integration As an overview, the graphics will need to know what the AI is doing, when chips are being passed around, and the cards available to the player. As an overview, the graphics will need to know what the AI is doing, when chips are being passed around, and the cards available to the player. When all of the above things are happening the GUI needs to change to accommodate what is happening in the backend. When all of the above things are happening the GUI needs to change to accommodate what is happening in the backend.

12 Integration The graphics engine will also need to have access to the save game and load game features The graphics engine will also need to have access to the save game and load game features As well as the ability to advance to the next stage in the game. As well as the ability to advance to the next stage in the game.

13 Success The graphics functions will work when the project is finished because they are modular. The graphics functions will work when the project is finished because they are modular. A button can act as a flag for almost anything. A button can act as a flag for almost anything. As long as allegro works as it should, the rest of the graphics should fall into place. As long as allegro works as it should, the rest of the graphics should fall into place.

14 Without Further Adieu Some buttons… Some buttons…

15 Shuffling Function Devin Thomas Gaines

16 Classes and Functions Classes Classes Deck Class Deck Class RandomNumber Class RandomNumber Class *Distribution Class (this will be optional) *Distribution Class (this will be optional) I wanted to make the code more functional and broke it down into modules for ease of integration.

17 Deck Class class Deck { public: // default conmstructor Deck(); // intializes the deck array and size of deck void initDeck( int deck[], int size ); //shuffles the deck using random number generator and swapping void shuffleDeck( int deck[], int size ); //deals hands given the number of players and cards per player //Max number of players is 10 (arbitrary value!) and max number of cards being dealt is 5 void dealHand( int deck[], int numberOfPlayers, int cardsPerHand); //sorts a deck void sortHand( int hand[], int size ); //prints a given hand or whole deck void printHand( int hand[], int size ); //prints individual cards void printCard( int card ); private: // sets size and array int deck[DECKSIZE]; };

18 RandomNumber Class class RandomNumber { public: // default conmstructor with defaults of 0&1 RandomNumber(int a=0, int b=1); // Mutator: // Sets high and low values void SetInterval(int a, int b); // Faclitators: // Display Random numbers... int DrawRandomNumber(); // Set seed using current time void SetTimerSeed(); private: // Inspectors: int GetLow(); int GetHigh(); // Data members int Low, High; };#endif

19 The Shuffle Program Here is a demo of how the shuffling program works. Here is a demo of how the shuffling program works. I basically made a main function that tests all my other functions using the printHand() and printCard() methods. I basically made a main function that tests all my other functions using the printHand() and printCard() methods. From here, I have these functions print out the original deck, the shuffled deck and then the sorted deck, which should resemble the original deck exactly. From here, I have these functions print out the original deck, the shuffled deck and then the sorted deck, which should resemble the original deck exactly. I also have the beginnings of a dealHand() function that will distribute the cards out among players. I also have the beginnings of a dealHand() function that will distribute the cards out among players.

20 Snapshots of Demo (Ex. 1)

21 Snapshots of Demo (Ex. 2)

22 Snapshots of Demo (Ex. 3)

23 Integration…how? The only class that will be communicating with the rest of the program is the Deck class. The only class that will be communicating with the rest of the program is the Deck class. There will need to be shuffleDoneFlag variable to let the Game Class know when shuffling has occurred and is complete. There will need to be shuffleDoneFlag variable to let the Game Class know when shuffling has occurred and is complete. Also, I will need to send my deck array to player algorithm and the best hand algorithm for further play and analysis. Also, I will need to send my deck array to player algorithm and the best hand algorithm for further play and analysis.

24 Current Issues Currently, I am working on the distribution of the random numbers in my program. Currently, I am working on the distribution of the random numbers in my program. At first, with the way that I seeded my random function, the distribution always came out to be the same. At first, with the way that I seeded my random function, the distribution always came out to be the same.

25 Reworking the Distribution I’m trying to vary distribution methods in order to make the program more random-like. I’m trying to vary distribution methods in order to make the program more random-like. So far I been working with uniform, normal and exponential distributions and shifting between those three types. So far I been working with uniform, normal and exponential distributions and shifting between those three types.

26 Any Possible Changes The only possible changes or additions that might happen is the formation of another class or function that will carry different distribution patterns for the shuffle program. The only possible changes or additions that might happen is the formation of another class or function that will carry different distribution patterns for the shuffle program.

27 AI Kwang Kim Kwang Kim

28 Methods bool Player::preFlop() { bool Player::preFlop() { int result = rankHand(firstCard, secondCard); switch (result) { case 1: case 1: raise(currBet); raise(currBet); break; break; case 2: case 2: callBet(currBet); callBet(currBet); break; break; case 3: case 3: fold(); fold(); break; break; default: default: cout << playerName << " pre-flop strategy" << endl; cout << playerName << " pre-flop strategy" << endl; break; break; } return true; return true; } //preflop uses the strength of the hand to //determine whether or not it is playable. //preflop uses the strength of the hand to //determine whether or not it is playable.

29 RankHand rankHand is used by the preflop strategy to determine what it should do. rankHand is used by the preflop strategy to determine what it should do. The method is too long to show here, but is just a function that uses a series of if statements to determine if the hand is “raise-able” “check- able” or “fold-able” The method is too long to show here, but is just a function that uses a series of if statements to determine if the hand is “raise-able” “check- able” or “fold-able”

30 Correctness The getter and setter functions that are in this class were tested through the console. The getter and setter functions that are in this class were tested through the console. By using options to set and get different values we were able to determine that they were working correctly. By using options to set and get different values we were able to determine that they were working correctly.

31 Correctness For the actual workhorse code, we used a different console application. For the actual workhorse code, we used a different console application. This separate console application was designed to take in two card values, and output if the player should fold, raise, or call. This separate console application was designed to take in two card values, and output if the player should fold, raise, or call. The result was that the subroutine rankHand was functioning properly The result was that the subroutine rankHand was functioning properly

32 Integration This module is what makes the game advance. This module is what makes the game advance. The player AI is responsible for making the decision to raise, call, or bet, and is essentially the thing that makes this game playable. The player AI is responsible for making the decision to raise, call, or bet, and is essentially the thing that makes this game playable.

33 Integration By making a Player class, we are able to modularize them, and add as many as we want to a table. By making a Player class, we are able to modularize them, and add as many as we want to a table. The only thing that comes out of integration is the automation of play. The only thing that comes out of integration is the automation of play. We are going to have to loop through all the active players and use the AI to make them decide what to do. We are going to have to loop through all the active players and use the AI to make them decide what to do.

34 This will work! The reason this will work is the same reason all the other pieces will work. The reason this will work is the same reason all the other pieces will work. It is all just many parts of a whole. It is all just many parts of a whole. In order to make that whole work, all of the pieces work symbiotically. In order to make that whole work, all of the pieces work symbiotically. With thorough testing and play we will succeed. With thorough testing and play we will succeed.

35 Best Hand Graham Gimbert Graham Gimbert

36 Minor Modifications The BestHand class has been slightly modified now to accommodate the recently agreed on naming convention The BestHand class has been slightly modified now to accommodate the recently agreed on naming convention BestHand no longer uses a list to keep track of the best hand, just a two dimensional 7x7 matrix of Cards. BestHand no longer uses a list to keep track of the best hand, just a two dimensional 7x7 matrix of Cards.

37 Methods Insert(Card temp) Insert(Card temp) {if (cardList[0] == NULL) cardList[0][0] = temp; else {for (int i = 0; i < 7; i++) {if (temp.rank >= cardList[i][0]) {for (int j = 7; j > i; j--) //Move cards ahead cardList[j][0] = cardList[j-1][0]; cardList[i][0] = temp;//Not shown, moving all downward cards }}} This is the basic idea of inserting the cards. This is the basic idea of inserting the cards.

38 Correctness The correctness of this was again tested with a console application. The correctness of this was again tested with a console application. Using the console application we are able to show that correct values are received… some of the time Using the console application we are able to show that correct values are received… some of the time The function is not quite finished yet. The function is not quite finished yet.

39 Correctness The testing application reads in 7 cards from user input, and runs the best hand algorithm. The testing application reads in 7 cards from user input, and runs the best hand algorithm. If the output matches the correct best hand, then we have a success. If the output matches the correct best hand, then we have a success.

40 Integration The place where the best hand algorithm belongs is in the Player class. The place where the best hand algorithm belongs is in the Player class. In order to determine what the player should do for a post flop strategy, the best hand algorithm is used. In order to determine what the player should do for a post flop strategy, the best hand algorithm is used. Since the best hand algorithm was encapsulated into a class, it makes it easy to add it anywhere it is needed. Since the best hand algorithm was encapsulated into a class, it makes it easy to add it anywhere it is needed.

41 Integration Once we have the finished best hand algorithm, we will able to finish up the player classes very quickly. Once we have the finished best hand algorithm, we will able to finish up the player classes very quickly. With the player classes done, and the shuffling done, we will be able to tie everything in together with the graphics and make the game functional. With the player classes done, and the shuffling done, we will be able to tie everything in together with the graphics and make the game functional.

42 Finished Integration We are confident, that with all of our functions finished, we will have a complete and functional product. We are confident, that with all of our functions finished, we will have a complete and functional product. There will be bugs, but that is to be expected. There will be bugs, but that is to be expected. The result of the integration will be a success, with hard work and determination. The result of the integration will be a success, with hard work and determination.


Download ppt "Milestone 4 Devin Gaines Devin Gaines Graham Gimbert Graham Gimbert Ikhan Mcclarty Ikhan Mcclarty James Cefaratti James Cefaratti Kwang Kim Kwang Kim Monarch."

Similar presentations


Ads by Google