For the final assignment in Introduction to C Programming for the Summer 2021 semester, we were tasked with creating a poker-like game that had three requirements: deal 2 hands, print out the hands of the players & determine who won the game.
As such, I created 5-Card Stud. A game that can deal up to 9 hands (and 1 dealer), determine the results of these hands, and determine who wins any tiebreakers, while printing all results to the screen.
This project built on the skills of logic & reasoning, problem solving, debugging and C programming.
In addition to these requirements, ties could be determined for "bonus points". As such, over the course of three weeks, I coded a version of 5 card stud poker. The computer deals an inputted amount of players, and then automatically determines who wins based off of hand strength / ranking. The biggest challenge for this project was determining tie breaker winners. In 5 Card Stud, the highest card is used to determine the winner of a tie, and may be more in depth depending on what the tie is for (a pair versus a flush). When there are ties that involve more than just the highest card (second highest, third highest, etc.), determine a winner became challenging. Using sorting, variables, and logic loops, I was able to accomplish this goal. Additionally, it was difficult to create a shuffled deck from scratch, without creating any duplicates. While the solution was simple, it took a large amount of time to figure out a solution.
The code for the program is shown below for looking, and can be compiled on a site such as onlinegdb. There are comments throughout the code to explain all major sections of code Note: if using an online IDE, the delay function will not work correctly. If complied with an on device IDE such as Dev-C++, the delay function will work properly.