GithubHelp home page GithubHelp logo

pjcook / jl-coding-challenge-017 Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 1.0 18 KB

In this challenge you need to create a function that determines whether a player or the dealer has won at the card game known in the UK as Pontoon. The function will receive one array containing all the cards for a player and another array containing all the cards for the dealer. It will return the winner (ie. “The player” or “The dealer”) and a description of the winning hand. Each card will be represented by two characters, the first character representing “rank” and the second character representing “suit”. Rank can be any of 2,3,4,5,6,7,8,9,T,J,Q,K,A (T=Ten, J=Jack, Q=Queen, K=King, A=Ace). Suit can be any of C,D,H,S (Clubs, Diamonds, Hearts, Spades). So TH will be 10 of Hearts. Winning hands (ordered by highest scoring) are: Pontoon - one card has a rank of ace and the other card is a picture card, i.e. has rank of J, Q or K. Five card Trick - there are five cards with a total value of 21 or less. Ace has value of one and picture cards have value of 10. The total value of the cards doesn’t matter as long as it is 21 or less. Highest total of 21 or less. Ace can have a value of one or eleven. e.g. two kings and an ace would have a value of 21 but an ace and a 3 would have a value of 14. Hands totalling more than 21 are “bust” and worth nothing The player must have a higher scoring hand than the dealer to win, otherwise the dealer wins. Sample data for a Pontoon: ["QH","AC"] Sample data for a five card trick: ["3D","2C","4H","AD","5C"] Sample data for total of 17: ["7C","AD","9H"] Sample data for total of 21: ["AD","8S","2H"] Sample data for total of 13: ["AD","AH","AS"]

License: MIT License

Swift 100.00%

jl-coding-challenge-017's People

Contributors

pjcook avatar

Watchers

 avatar  avatar

Forkers

linhbg1998

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.