Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!