ucsb-cs56-projects / cs56-games-poker

-
MIT License
2 stars 11 forks source link

cs56-games-poker

GUI application that simulates a Texas Holdem style Poker Game using 2 decks.

project history

 (pconrad) Poker Game | W14 | W16 | M16

Playing the Game

To start the game, type the command

ant run

Game Options :

Screenshots

Main Menu

Rules

Single Player

Creating Chat Server

Enter Username for Chat

Chat

Rules

Betting

Folding

Winning

End Of Game

JavaDoc

To see JavaDoc and overall structure of the game, type the command:

ant javadoc

Code Assessment

The code is seperated into a multitude of classes.

M16 final remarks

Poker Single Player begins to follow a "Factory Design" pattern for PokerGame. Deck is in charge of the deck, Hand is in charge of the player's hand, Player has a hand, TableCard holds the table cards, Poker Game holds Players, a Deck, and TableCards. When we rewrote the Poker Game just for a single player, we completely got rid of our multiplayer version in favor of an understandable design. This is where you come in, we left a good basic heirarchy of the single player game and we want you to extend our PokerGame class to create the multiplayer aspect of the game through the server. See the many issues we created last year and see which ones you can tackle. Feel free to restart the idea of the Chat Button, we kept it there because it had no influence with the Single Player game when we rewrote the code. A good idea is that you should develop a better server with a hierarchal structure to make the PokerServer (aka MultiPlayer Server). Future improvements and ideas that you can do are improving the GUI layout and creating a new class to take on GUI responsibilities of the PokerGame. You can add better animations to the cards (and maybe even poker chips)! The rules sheet opens in a new window, rather, you can add it directly within the PokerGame. You can also integrate chat with the multiplayer game and disable it from the singleplayer mode. This game actually has tons of room for improvement and we can't wait to see what you come up with!

F16 final remarks

To learn about the code, please refer to the code assessment section above. Overall, we have tried to move the code towards setting up a good base for future features. We separated the PokerSinglePlayer into two classes: one that contains the logic, and one that contains the GUI. The PokerSinglePlayer extends GUI, and GUI extends PokerGame. We also made some minor improvements to the gameplay, such as randomizing who gets to bet first and adding the rules image inside of the game itself. Originally, we wanted to add a multiplayer. However, as it stands, PokerServer and PokerClient need a major revamp before that can be done. Please refer to those issues for more information. The first thing we recommend you tackle is improving the CompareHands class. After we created a test class, we discovered that it contains some bugs. We got rid of some major bugs but there’s still a lot of room for improvement. Please read the issue we left for more information on that. From then on, it is up to you whether you want to continue improving single player, or to begin adding more features. Should you choose to improve single player, consider taking the AI out of Poker Single Player and making it its own class. Our dream for this game was to create a multiplayer that allowed you to chat with the players while you played with them. There’s so many different directions you can take with this game, but remember that it is more pertinent to fix present bugs and design issues than it is to add features.

F17 Final Remarks

For an assessment of the basic program structure, please refer to the code assessment section above. In addition to fixing some relatively minor issues, such as Javadoc generation and comments, we tried to improve CompareHands and make it easier for the (currently single player only) game to be extended to include multiplayer functionality.

Minor Issues Fixed:

Major Issues Fixed:

Since Users and AIs can both be thought of as Players, extending the code to multiplayer should be easier since all players can be referred to using Player references, regardless of whether or not the player is a user or AI.

Recommendations:

Because of the current state of the code base, we recommend refactoring the code for multiplayer before adding new features. Currently, the assumption that the game has only 2 players is reflected in much of the logic and much of the existing code requires significant refactoring to support multiplayer. Some of the issues, such as incorporating the chat server into the game GUI window, are only truly relevant if multiplayer has already been implemented. Additionally, the implementation for new features will likely differ depending on whether or not the game supports multiplayer. Adding too many features without adding multiplayer might make the code too dependent on the assumption that there are only two players for it to be feasible to be extended to multiplayer. One piece of general advice about refactoring the code to allow multiplayer is don't be surprised if you find yourself changing much (or most) of the code. As has been previously stated, the most of the existing code assumes only two players. Adding multiplayer requires significant change to existing code, showing how programming to implementations instead of interfaces can result in a program both difficult to maintain and extend.

W18 Final Remarks

For an assessment of the basic program structure, please refer to the code assement section above. The original state of the code was hardcoded throughout the program to assume there were only two players, a user and an opponent, and we refactored that code to create a program that can handle an arbitrary amount of players as long as the GUI is refactored. As of now, we assume there are only four players, one user and three computers, but in the future that can be changed to support a larger amount of players.

Minor Issues Fixed

Major Issues Fixed

Recommendations

After we refactored the project to multiplayer, there are some errors in CompareHands.java in which some match-ups don't calculate properly. Use the CompareHandsTest.java to be sure, but some examples we're sure of is when two people have the same hand (ie: a pair of 4's vs a pair of 5's) it counts it as a tie instead of the higher hand winning. Also, currently winner gets set to 0 when a tie occurs at the moment to avoid an out-of-index error, but consider figuring a way around that to set a unique number for ties. Try to figure out a way to get compareHands() to call the tie functions in order to figure out which tying hand is higher. Also, compareHands shouldn't take folded players into account when calculating the winning hand, but it currently does. Right now, the rules panel only pop-ups a single image instead of the entire rules, so consider implementing a scroll panel or something similar. A piece of advice is to utilize system outputs in order to check your functions; it helps figure out where things are going wrong or which clauses are getting executed. Something in multiplayer, with many opponents, if you bet a certain amount, only the first opponent will call and the others won't lose their chips (they don't know how to react to other opponent/CPU players).