Skip to content

Instantly share code, notes, and snippets.

@donalmurtagh
Last active January 21, 2022 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donalmurtagh/3dc0c9a9d7f2a49dd05cf1bbaa199218 to your computer and use it in GitHub Desktop.
Save donalmurtagh/3dc0c9a9d7f2a49dd05cf1bbaa199218 to your computer and use it in GitHub Desktop.
Stupid Poker

Introduction

Stupid poker is a variant of poker that removes all skill and decision-making from the game, reducing it to a simple game of chance. The rules are as follows: ​

  1. Each player is dealt 2 private cards (AKA hole cards) that only they can use
  2. 5 communal cards are dealt which may be used by every player
  3. Each player must make the best 5-card poker hand from the 7 cards available to them
  4. The winner is the player with the best hand according to the standard ranking of poker hands

Notes

  • There is no betting, checking, raising, folding or indeed anything else that isn't mentioned above
  • Hands are ranked in exactly the same fashion as Texas hold'em (and many other poker games).
  • When determining whether a player has a straight (5 consecutive cards), an Ace may be considered either the lowest-ranked (1) or highest-ranked (14) card in the deck

Example

  • Player A's 2 private cards are a queen and a jack
  • Player B's 2 private cards are a queen and a 10
  • The communal cards are: 2, 3, 8, 9, queen
  • Player A's best hand is therefore: a pair of queens, 8, 9, jack
  • Player B's best hand is therefore: a pair of queens, 8, 9, 10
  • Player A wins because jack > ten

Assignment

Implement a game of stupid poker. Each game proceeds as follows

  • The user is asked to enter the number of players (max. 23)
  • The private and communal cards are dealt and shown in the UI
  • The best hand of each player is calculated and displayed in the UI
  • The winning player is displayed
  • The game ends

The user interface could be either a console or a simple web page. The UI doesn't need to be fancy, e.g. it's perfectly fine to use 10♠ to represent the ten of spades.

The game can be implemented using any combination of the following languages: Java, JavaScript, Kotlin, Groovy and you are free to use any 3rd party libraries/frameworks. If the game is presented as a webpage, you can obviously use HTML and CSS too.

In addition to the game itself, your solution should include a suite of tests. The key task in this exercise is to compare 2 poker hands (2 private cards and 5 communal cards) and determine which is the winning hand (or whether both hands are of equal value), so this is the area the tests should focus on. It's not feasible to write a test for every possible combination of poker hands, so choose a reasonable selection of common cases and edge cases.

Your solution should be pushed to a repo on GitHub on repo that we can access. You must send clear instructions for how to build/run your solution e.g.

execute npm install followed by npm run serve in the project root then open http://localhost:8888 in a web browser

You should clearly document any dependencies required to build/run the project, e.g.

Node 12 or later is installed and npm is on the PATH

Evaluation

While we would ideally like to receive a complete solution i.e. a solution which correctly identifies the winning poker hand in all possible cases, we're more interested in the quality of the solution than completeness. In other words, a high quality solution which omits a few edge cases and has good test coverage will receive more credit than a complete, but low-quality solution.

@TheodoreR-cpu
Copy link

TheodoreR-cpu commented Aug 19, 2021

Looks cool. Did you create it yourself? I ask it because I saw the same rules in one of Japan casinos. So it's not unique rules. But also I can made a mistake. Also, I saw the same projects here - http://ebitsu.net/archives/84871398.html. But the site in Japanees, and there needs to do a little research to find something.

@DylanBogle
Copy link

DylanBogle commented Jan 19, 2022

Sieht gut aus. In all den Jahren, in denen ich Poker spiele, habe ich das noch nie in einem Online-Casino gesehen. Jetzt bin ich in die Schweiz gezogen und suche ein Casino, in dem ich spielen kann. Eines Tages stieß ich bei meiner Suche nach einem Online-Casino auf eine gute Bewertung unter https://schweizercasinoclub.com/neue-online-casinos/ Der Artikel hat mir sehr gut gefallen, aber ich kann nicht aufhören zu suchen. Sag mir, kann ich deine Option nutzen, um mit Freunden zu spielen? Da diese Option recht simpel und spannend aussieht, und etwas Erfahrung in einer neuen Art von Poker auch sehr cool ist. Danke im Voraus für die Antwort .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment