Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Function Name: poker Inputs: (double) a vector representing someone's poker hand Output: (char) representing type of poker hand . Description: Write a function called poker

Function Name: poker Inputs: (double) a vector representing someone's poker hand Output: (char) representing type of poker hand . Description: Write a function called poker that takes in a double vector representing someone's hand of 5 cards and outputs the highest value hand they have. For simplicity, we represent an Ace as 14, King as 13, Queen as 12 and Jack as 11. Below are a description of each kind of hand we will consider: 'Royal Flush': a hand made up of the cards [14 13 12 11 10] \"Four of a Kind' a hand made up of four cards of the same rank (ex: [11 11 13 11 111) . 'Full House': a hand with three of a kind with a pair (ex: [10,10,9,10,91) \"Straight': Five cards that form a sequence (ex:[11,12,10, 8, 9]) Three of a Kind': Three cards of the same rank (ex: [137737]) . Two Pair': two different pairs (ex: [4 3 12 3 4]) Pair: two cards of the same rank (ex: (14 8 14 4 7]) Nothing': none of the above (ex: [1 2 3 4 6]) The above list is an ordered heirarchy, meaning the first type of hand (Royal Flush) has the highest value and the last hand (Pair) has the lowest value. Your function should output the name of the highest value hand. The name of each type of hand is written in bold above and your output should match these EXACTLY. Notes: Notice a Full House is made up of Three of a kind and a Pair; however, you should output Full House because this is the highest value. . The inputted order of the cards doesnt matter. Pairs and Straights can still exist even if they aren't initially adjacent. %Examples (These match the ones in the bulleted list above) out1 = poker([14 13 12 11 101) out2 = poker([11 11 13 11 11]) out 3 = poker([10,10,9,10,9]) out4 = poker((11,12,10,8,9]) outs = poker([13 7 7 3 7]) out6 = poker([4 3 12 3 4]) out7 = poker((14 8 14 4 7]) out8 = poker([1 2 3 4 6])

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions