Git Product home page Git Product logo

poker-takehome's Introduction

poker-takehome

Swept coding challenge allowing you to showcase your logic handling and code structuring abilities.

Overview

Write a simple app that can take two 5-card poker hands, classify each hand, and determine which hand would win. For this problem suits are ignored, so a flush will not be possible.

Each card can be represented by a single character:

  • A for ace
  • K for king
  • Q for queen
  • J for jack
  • T for ten
  • 2-9 for the remaining
  • * for a wild card (max of 1 per hand)

Hand Classifications

Hand classifications are as follows (highest to lowest):

  • four-of-a-kind (4 cards of the same value: AAAA5)
  • full house (3 of one, and 2 of another: KKKQQ)
  • straight (all 5 in sequential order: 6789T)
  • three-of-a-kind (3 cards of the same value: KKK23)
  • two pair (AA33J)
  • pair (44KQA)
  • high card (nothing else: A267J)

Comparison Rules

When comparing two pair hands, compare the highest pair first, then the next pair (i.e. AA223 > KKQQT, since AA > KK). When the highest pair is a tie, move on to the next pair (i.e. AA993 > AA88K).

Similarly, when comparing full house hands, the three-card group is compared first (i.e. AAA22 > KKKQQ).

In the case of ties, determine a winner by comparing the next highest card in the hand (i.e. AA234 < AA235 because AAs tie, 2s tie, 3s tie, but 4 < 5).

Straights are compared by the highest card in the hand, except for A2345, in which case the 5 is considered the highest card in the straight.

Wild Cards

When there is a wild card (*), the final hand has to be a valid 5-card poker hand (no five-of-a-kind!)

Results

For each comparison, display the classification and indicate which hand would win or that the result is a tie.

Examples:

  • AAAKT vs 22233: AAAKT three-of-a-kind < 22233 full house
  • 2345* vs KKJJ2: 2345* straight > KKJJ2 two pair
  • AAKKT vs AAKKT: AAKKT two pair == AAKKT two pair
  • KKKKA vs KKKK*: KKKKA four-of-a-kind == KKKK* four-of-a-kind

Evaluation Criteria

Don't worry about the visuals. Plain text inputs are totally fine. We're just looking for clean code.

  1. Ease of understanding code structure and logic
  2. Ease of running module and testing specific hands
  3. Proper handling of inputs, edge cases and wild cards
  4. Well documented README.md
  5. Bonus points for including some unit Tests for core logic

Steps you should take

  1. Go through the requirements and let us know if you have any questions
  2. Come up with a realistic estimate of how long it will take you to get this done
  3. Share your GitHub repo for the take-home with us

poker-takehome's People

Contributors

supercoderdom avatar

Watchers

 avatar

Forkers

boothlinux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.