{"group":{"group":{"id":15,"name":"Card Games","lockable":false,"created_at":"2016-12-21T16:29:02.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems based around games played with a deck of cards.","is_default":false,"created_by":26769,"badge_id":29,"featured":false,"trending":false,"solution_count_in_trending_period":3,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":394,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eProblems based around games played with a deck of cards.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}","description_html":"\u003cdiv style = \"text-align: start; line-height: normal; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; perspective-origin: 289.5px 10.5px; transform-origin: 289.5px 10.5px; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; perspective-origin: 266.5px 10.5px; transform-origin: 266.5px 10.5px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eProblems based around games played with a deck of cards.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","published_at":"2019-05-08T19:55:00.000Z"},"current_player":null},"problems":[{"id":2482,"title":"Card Game","description":"This is an overly simplified and highly modified version of card game Twenty-Nine.\r\n\r\nA deck of 100 unique cards (hypothetical) is randomly shuffled and divided into two equal parts. One is given to you and one to bot. Bot plays a card first. Then, you play a card. If your card is higher, you win that round. This is repeated until all cards are played.\r\n\r\nBot plays cards randomly and it will always play the first card. Your task is to devise a strategy so that your routine wins 75 percent or more rounds. Your function will be provided with two inputs, the card played by the bot and cards left to you.\r\n\r\n(This is partially dependent on luck. I might change the winning condition (75 percent or more wins currently) depending on performance without re-scoring.)","description_html":"\u003cp\u003eThis is an overly simplified and highly modified version of card game Twenty-Nine.\u003c/p\u003e\u003cp\u003eA deck of 100 unique cards (hypothetical) is randomly shuffled and divided into two equal parts. One is given to you and one to bot. Bot plays a card first. Then, you play a card. If your card is higher, you win that round. This is repeated until all cards are played.\u003c/p\u003e\u003cp\u003eBot plays cards randomly and it will always play the first card. Your task is to devise a strategy so that your routine wins 75 percent or more rounds. Your function will be provided with two inputs, the card played by the bot and cards left to you.\u003c/p\u003e\u003cp\u003e(This is partially dependent on luck. I might change the winning condition (75 percent or more wins currently) depending on performance without re-scoring.)\u003c/p\u003e","function_template":"function y = call(a,b)\r\n\r\n% a is the card played by bot\r\n% b are the cards left to you\r\n% example: \r\n% a=4\r\n% b=[10 21 31 4 5 62 7]\r\n% may be, play 7 (y = 7) to win this round\r\n\r\n\r\nend","test_suite":"%%\r\n\r\nfor i=1:randi(1000)\r\n    vec = randperm(100);\r\nend\r\n\r\nvec = randperm(100);\r\n\r\na = vec(1:50);    % given to bot\r\nb = vec(51:100);  % given to player\r\n\r\nyou = 0;\r\nbot = 0;\r\n\r\nfor i = 1:50\r\n    c = call(a(1),b);\r\n    if ~ismember(c,b)\r\n        while(1)\r\n        end\r\n    end\r\n    \r\n    \r\n    if c\u003ea(1)\r\n        you = you + 1;\r\n    else\r\n        bot = bot + 1;\r\n    end\r\n    b(b==c)=[];\r\n    a(1)=[];\r\nend\r\n\r\nif you\u003cfloor(50*0.75)\r\n    while(1)\r\n        disp('not enough wins');\r\n    end\r\nend ","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":112,"test_suite_updated_at":"2014-08-04T18:12:30.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2014-08-04T16:49:44.000Z","updated_at":"2026-04-01T19:01:18.000Z","published_at":"2014-08-04T16:49:44.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is an overly simplified and highly modified version of card game Twenty-Nine.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA deck of 100 unique cards (hypothetical) is randomly shuffled and divided into two equal parts. One is given to you and one to bot. Bot plays a card first. Then, you play a card. If your card is higher, you win that round. This is repeated until all cards are played.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBot plays cards randomly and it will always play the first card. Your task is to devise a strategy so that your routine wins 75 percent or more rounds. Your function will be provided with two inputs, the card played by the bot and cards left to you.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(This is partially dependent on luck. I might change the winning condition (75 percent or more wins currently) depending on performance without re-scoring.)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":329,"title":"Poker Series 01: isStraightFlush","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n--------\r\nA straight flush is 5 cards of the same suit (row) and five continuous ranks (columns). The Ace (first column) can also make a straight flush when combined with the last four columns. The columns represent A, 2, 3, ... K.\r\nThis hand matrix:\r\n0 1 1 1 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\nrepresents a straight flush, so the return value from the function is TRUE.\r\nThis hand matrix does not:\r\n0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 1 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\nso the return value should be FALSE.\r\nThis hand matrix does represent a straight flush\r\n1 0 0 0 0 0 0 0 0 1 1 1 1 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 1 0 0 0 0 0 0 0\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 1 0 1 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0\r\nWould be FALSE for this function.\r\nA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Straight Flush. If more than one straight flush can be made, return the higher ranking one (the one with the highest top card. Ace being the highest). If different suits are possible for the same straight flush, return the one higher up in the matrix.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 940.933px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 470.467px; transform-origin: 407px 470.467px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373px 8px; transform-origin: 373px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373px 8px; transform-origin: 373px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 20px 8px; transform-origin: 20px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e--------\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 369.5px 8px; transform-origin: 369.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA straight flush is 5 cards of the same suit (row) and five continuous ranks (columns). The Ace (first column) can also make a straight flush when combined with the last four columns. The columns represent A, 2, 3, ... K.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 54px 8px; transform-origin: 54px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis hand matrix:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 1 1 1 1 1 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 230.5px 8px; transform-origin: 230.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003erepresents a straight flush, so the return value from the function is TRUE.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 83.5px 8px; transform-origin: 83.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis hand matrix does not:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 1 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 118px 8px; transform-origin: 118px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eso the return value should be FALSE.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 150.5px 8px; transform-origin: 150.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis hand matrix does represent a straight flush\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e1 0 0 0 0 0 0 0 0 1 1 1 1 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 1 0 0 0 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 1 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 221.5px 8px; transform-origin: 221.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 1 0 1 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 1 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 106px 8px; transform-origin: 106px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWould be FALSE for this function.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 370px 8px; transform-origin: 370px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Straight Flush. If more than one straight flush can be made, return the higher ranking one (the one with the highest top card. Ace being the highest). If different suits are possible for the same straight flush, return the one higher up in the matrix.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function out = isStraightFlush(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 1 1 1 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0\r\n      0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 1 1 1 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isStraightFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0\r\n      0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isStraightFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      1 0 0 0 0 0 0 0 0 1 1 1 1\r\n      0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 1 1 1 1\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isStraightFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      1 0 0 0 0 0 0 0 0 1 1 1 1\r\n      1 1 0 0 0 0 0 0 0 1 1 1 1 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 1 1 1 1\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isStraightFlush(hm),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":8,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":124,"test_suite_updated_at":"2021-09-27T06:47:34.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-16T20:30:55.000Z","updated_at":"2026-04-02T20:19:31.000Z","published_at":"2012-02-17T18:24:19.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA straight flush is 5 cards of the same suit (row) and five continuous ranks (columns). The Ace (first column) can also make a straight flush when combined with the last four columns. The columns represent A, 2, 3, ... K.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 1 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a straight flush, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 1 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a straight flush\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1 0 0 0 0 0 0 0 0 1 1 1 1 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 1 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 1 0 1 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be FALSE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Straight Flush. If more than one straight flush can be made, return the higher ranking one (the one with the highest top card. Ace being the highest). If different suits are possible for the same straight flush, return the one higher up in the matrix.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2481,"title":"Mongean Shuffle : 2","description":"Extension to  \u003chttps://www.mathworks.com/matlabcentral/cody/problems/2479-mongean-shuffle problem 2479\u003e:\r\n\r\nDetermine the number of complete set of Mongean shuffles required to get the original status of a deck of cards of length n.","description_html":"\u003cp\u003eExtension to  \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/2479-mongean-shuffle\"\u003eproblem 2479\u003c/a\u003e:\u003c/p\u003e\u003cp\u003eDetermine the number of complete set of Mongean shuffles required to get the original status of a deck of cards of length n.\u003c/p\u003e","function_template":"function y = Mnum(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 52;\r\ny_correct = 12;\r\nassert(isequal(Mnum(x),y_correct))\r\n\r\n%%\r\nx = 10;\r\ny_correct = 6;\r\nassert(isequal(Mnum(x),y_correct))\r\n\r\n%%\r\nx = 9;\r\ny_correct = 4;\r\nassert(isequal(Mnum(x),y_correct))\r\n\r\n%%\r\nx = 1000;\r\ny_correct = 308;\r\nassert(isequal(Mnum(x),y_correct))\r\n\r\n%%\r\nx = 100;\r\ny_correct = 33;\r\nassert(isequal(Mnum(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = 2;\r\nassert(isequal(Mnum(x),y_correct))\r\n\r\n%%\r\nx = 17;\r\ny_correct = 5;\r\nassert(isequal(Mnum(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":65,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":15,"created_at":"2014-08-04T14:19:45.000Z","updated_at":"2026-04-02T19:25:52.000Z","published_at":"2014-08-04T14:19:45.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExtension to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/2479-mongean-shuffle\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 2479\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDetermine the number of complete set of Mongean shuffles required to get the original status of a deck of cards of length n.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2479,"title":"Mongean Shuffle","description":"A Mongean shuffle of an n card deck starts with putting the initial deck on the left hand side.\r\n\r\n* The top card of the deck is taken and put on the right hand side. \r\n* The second card from the deck on left is taken and put on top of right deck. \r\n* The third card is taken from the left and and put at the bottom of the right deck.\r\n* The fourth card is put on top of right deck.\r\n* The fifth card is put at the bottom of right deck.\r\n\r\nThis process is continued until all the cards on left are transferred to the right.\r\n\r\nThe initial state of the cards will be given. Return the state after this shuffle.","description_html":"\u003cp\u003eA Mongean shuffle of an n card deck starts with putting the initial deck on the left hand side.\u003c/p\u003e\u003cul\u003e\u003cli\u003eThe top card of the deck is taken and put on the right hand side.\u003c/li\u003e\u003cli\u003eThe second card from the deck on left is taken and put on top of right deck.\u003c/li\u003e\u003cli\u003eThe third card is taken from the left and and put at the bottom of the right deck.\u003c/li\u003e\u003cli\u003eThe fourth card is put on top of right deck.\u003c/li\u003e\u003cli\u003eThe fifth card is put at the bottom of right deck.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThis process is continued until all the cards on left are transferred to the right.\u003c/p\u003e\u003cp\u003eThe initial state of the cards will be given. Return the state after this shuffle.\u003c/p\u003e","function_template":"function y = mshuffle(x)\r\n\r\n\r\nend","test_suite":"%%\r\n% trivial\r\nx = 1;\r\ny_correct = 1;\r\nassert(isequal(mshuffle(x),y_correct))\r\n\r\n%%\r\nx = 1:5;\r\ny_correct = [4     2     1     3     5];\r\nassert(isequal(mshuffle(x),y_correct))\r\n\r\n\r\n%%\r\na = magic(5);\r\na=a(:)';\r\ny_correct = [3    16     2    20     8    19     7    18     6    24    10    23    17     4    11     5    12     1    13    25    14    21    15    22     9];\r\nassert(isequal(mshuffle(a),y_correct));\r\n\r\n\r\n%%\r\nx = 7:-1:1;\r\ny_correct = [2     4     6     7     5     3     1];\r\nassert(isequal(mshuffle(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":95,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":15,"created_at":"2014-08-04T10:33:51.000Z","updated_at":"2026-04-02T19:19:20.000Z","published_at":"2014-08-04T10:33:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA Mongean shuffle of an n card deck starts with putting the initial deck on the left hand side.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe top card of the deck is taken and put on the right hand side.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe second card from the deck on left is taken and put on top of right deck.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe third card is taken from the left and and put at the bottom of the right deck.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe fourth card is put on top of right deck.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe fifth card is put at the bottom of right deck.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis process is continued until all the cards on left are transferred to the right.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe initial state of the cards will be given. Return the state after this shuffle.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2318,"title":"Combine Cards to make 21","description":"Given between two and six cards, e.g.\r\n\r\n A _ 3 _ 7 _ 6 _ 2\r\n\r\nplace one of the mathematical symbols (+,-,*,/) in the space between each\r\npair of cards to make the equation equal 21.\r\n\r\nThe input will be a string, e.g.\r\n\r\n* 'A3762'\r\n\r\nThe output should be a cell array of mathematical symbols in the order that satisfies the puzzle, e.g. for the string given above, the output would be:\r\n\r\n  {'+-*/'}\r\n\r\nWhich means that A + 3 - 7 * 6 / 2 = 21.\r\n\r\n*  A + 3 = 14\r\n* 14 - 7 = 7\r\n*  7 * 6 = 42\r\n* 42 / 2 = 21\r\n\r\nRules:\r\n\r\n* The Ace can represent either 1 or 11.\r\n* All operations should be performed from left to right\r\n* Cards will be represented by the characters: A,2,3,4,5,6,7,8,9,J,Q,K\r\n","description_html":"\u003cp\u003eGiven between two and six cards, e.g.\u003c/p\u003e\u003cpre\u003e A _ 3 _ 7 _ 6 _ 2\u003c/pre\u003e\u003cp\u003eplace one of the mathematical symbols (+,-,*,/) in the space between each\r\npair of cards to make the equation equal 21.\u003c/p\u003e\u003cp\u003eThe input will be a string, e.g.\u003c/p\u003e\u003cul\u003e\u003cli\u003e'A3762'\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe output should be a cell array of mathematical symbols in the order that satisfies the puzzle, e.g. for the string given above, the output would be:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e{'+-*/'}\r\n\u003c/pre\u003e\u003cp\u003eWhich means that A + 3 - 7 * 6 / 2 = 21.\u003c/p\u003e\u003cul\u003e\u003cli\u003eA + 3 = 14\u003c/li\u003e\u003cli\u003e14 - 7 = 7\u003c/li\u003e\u003cli\u003e7 * 6 = 42\u003c/li\u003e\u003cli\u003e42 / 2 = 21\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eRules:\u003c/p\u003e\u003cul\u003e\u003cli\u003eThe Ace can represent either 1 or 11.\u003c/li\u003e\u003cli\u003eAll operations should be performed from left to right\u003c/li\u003e\u003cli\u003eCards will be represented by the characters: A,2,3,4,5,6,7,8,9,J,Q,K\u003c/li\u003e\u003c/ul\u003e","function_template":"function mathSyms = solveBlackjackPuzzle(cards)\r\n  mathSyms  = {'+'};\r\nend","test_suite":"%% Example Case\r\ncards = 'A3762';\r\nmathSymbols = {'+-*/'};\r\nassert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))\r\n\r\n%%\r\ncards = 'A23QJK';\r\nmathSymbols = {'+-/++'};\r\nassert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))\r\n\r\n%%\r\ncards = '923';\r\nmathSymbols = {'*+', '-*'};\r\nassert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))\r\n\r\n%%\r\ncards = 'A23456';\r\nmathSymbols = {'**+++', '*+*-+', '*-+*+', '+++++', '+++-+', '-+/*+', '--+++', '/-*++', '/--+*'};\r\nassert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))\r\n\r\n%%\r\ncards = 'JQKA';\r\nmathSymbols = {'*/+', '+-+', '-++', '/*+'};\r\nassert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))\r\n\r\n%%\r\ncards = 'KA';\r\nmathSymbols = {'+'};\r\nassert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))\r\n\r\n%%\r\ncards = 'AAA';\r\nmathSymbols =  {'+-','-+'};\r\nassert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))","published":true,"deleted":false,"likes_count":4,"comments_count":4,"created_by":1446,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":"2014-05-16T13:53:18.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2014-05-13T15:52:33.000Z","updated_at":"2026-02-15T04:01:31.000Z","published_at":"2014-05-13T15:53:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven between two and six cards, e.g.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ A _ 3 _ 7 _ 6 _ 2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eplace one of the mathematical symbols (+,-,*,/) in the space between each pair of cards to make the equation equal 21.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe input will be a string, e.g.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'A3762'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe output should be a cell array of mathematical symbols in the order that satisfies the puzzle, e.g. for the string given above, the output would be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[{'+-*/'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhich means that A + 3 - 7 * 6 / 2 = 21.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA + 3 = 14\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e14 - 7 = 7\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e7 * 6 = 42\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e42 / 2 = 21\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRules:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Ace can represent either 1 or 11.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAll operations should be performed from left to right\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCards will be represented by the characters: A,2,3,4,5,6,7,8,9,J,Q,K\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1687,"title":"Poker Card Deal!","description":"Anyone want to play a card game?  \r\n\r\nWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards.  Rows are the amount of people in play, columns are the amount of cards dealt to each person.  The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\r\n\r\nThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J.  The suits are s for spades, d for dimonds, h for hearts and c for clubs.  \r\n\r\nSo the final cards look like this:\r\n\r\n'js'\r\n\r\n'J'\r\n\r\n'2h'\r\n\r\n'ad'\r\n\r\n'5c' and so on.\r\n\r\nThis function reads in three variables, these are:\r\n\r\npeople -- This is the amount of people that the cards are being dealt to.\r\n\r\ncardsDelt  -- This is the amount of cards dealt to each person.\r\n\r\nisJokerIn --  This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\r\n\r\nso an example is the following, if the variables are:\r\n\r\n%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\r\n\r\npeople = 5;\r\n\r\ncardsDelt = 5; %note, this is a typical deal for a poker game...\r\n\r\nisJokerIn = 0; \r\n\r\nThe outputs will be:\r\n\r\ndealtDeck = \r\n\r\n    'qh'    'as'    '5s'     '2s'    'jd' \r\n    'ad'    '5d'    '9s'     '7h'    'ah' \r\n    '3c'    '2d'    'ac'     '8c'    'qd' \r\n    'kh'    '5h'    '4c'     '3h'    '10s'\r\n    '6h'    '8h'    '10c'    '4s'    '8d' \r\n\r\n%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\r\n\r\ndeckLeftover = \r\n\r\n    '3s'\r\n    '4h'\r\n    '2c'\r\n    '5c'\r\n    'qs'\r\n    'jh'\r\n    'kd'\r\n    '2h'\r\n    '9c'\r\n    '10h'\r\n    '9h'\r\n    '6d'\r\n    '7c'\r\n    '7s'\r\n    '8s'\r\n    'qc'\r\n    'js'\r\n    '9d'\r\n    '7d'\r\n    'ks'\r\n    '6c'\r\n    '6s'\r\n    '3d'\r\n    '10d'\r\n    'jc'\r\n    '4d'\r\n    'kc'\r\n\r\nWell I hope that everyone has fun with it!  Thank you!\r\n\r\n","description_html":"\u003cp\u003eAnyone want to play a card game?\u003c/p\u003e\u003cp\u003eWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards.  Rows are the amount of people in play, columns are the amount of cards dealt to each person.  The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\u003c/p\u003e\u003cp\u003eThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J.  The suits are s for spades, d for dimonds, h for hearts and c for clubs.\u003c/p\u003e\u003cp\u003eSo the final cards look like this:\u003c/p\u003e\u003cp\u003e'js'\u003c/p\u003e\u003cp\u003e'J'\u003c/p\u003e\u003cp\u003e'2h'\u003c/p\u003e\u003cp\u003e'ad'\u003c/p\u003e\u003cp\u003e'5c' and so on.\u003c/p\u003e\u003cp\u003eThis function reads in three variables, these are:\u003c/p\u003e\u003cp\u003epeople -- This is the amount of people that the cards are being dealt to.\u003c/p\u003e\u003cp\u003ecardsDelt  -- This is the amount of cards dealt to each person.\u003c/p\u003e\u003cp\u003eisJokerIn --  This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\u003c/p\u003e\u003cp\u003eso an example is the following, if the variables are:\u003c/p\u003e\u003cp\u003e%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\u003c/p\u003e\u003cp\u003epeople = 5;\u003c/p\u003e\u003cp\u003ecardsDelt = 5; %note, this is a typical deal for a poker game...\u003c/p\u003e\u003cp\u003eisJokerIn = 0;\u003c/p\u003e\u003cp\u003eThe outputs will be:\u003c/p\u003e\u003cp\u003edealtDeck =\u003c/p\u003e\u003cpre\u003e    'qh'    'as'    '5s'     '2s'    'jd' \r\n    'ad'    '5d'    '9s'     '7h'    'ah' \r\n    '3c'    '2d'    'ac'     '8c'    'qd' \r\n    'kh'    '5h'    '4c'     '3h'    '10s'\r\n    '6h'    '8h'    '10c'    '4s'    '8d' \u003c/pre\u003e\u003cp\u003e%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\u003c/p\u003e\u003cp\u003edeckLeftover =\u003c/p\u003e\u003cpre\u003e    '3s'\r\n    '4h'\r\n    '2c'\r\n    '5c'\r\n    'qs'\r\n    'jh'\r\n    'kd'\r\n    '2h'\r\n    '9c'\r\n    '10h'\r\n    '9h'\r\n    '6d'\r\n    '7c'\r\n    '7s'\r\n    '8s'\r\n    'qc'\r\n    'js'\r\n    '9d'\r\n    '7d'\r\n    'ks'\r\n    '6c'\r\n    '6s'\r\n    '3d'\r\n    '10d'\r\n    'jc'\r\n    '4d'\r\n    'kc'\u003c/pre\u003e\u003cp\u003eWell I hope that everyone has fun with it!  Thank you!\u003c/p\u003e","function_template":"function [dealtDeck, deckLeftover] = Poker_Deal(people,cardsDelt,isJokerIn)\r\ndealtDeck ='this is the dealt deck to players'\r\ndeckLeftover = 'is the left over cards in the deck, after being delt'\r\nend","test_suite":"%%\r\npeople = 5;\r\ncardsDelt = 5;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 25) \u0026 ~issorted(reshape(dealtDeck,25,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-25)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 5;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 15) \u0026 ~issorted(reshape(dealtDeck,15,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-15)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 4;\r\ncardsDelt = 7;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 28) \u0026 ~issorted(reshape(dealtDeck,28,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-28)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 5;\r\ncardsDelt = 6;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 30) \u0026 ~issorted(reshape(dealtDeck,30,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-30)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 4;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 12) \u0026 ~issorted(reshape(dealtDeck,12,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-12)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 3;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac';  'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 9) \u0026 ~issorted(reshape(dealtDeck,9,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-9)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":15,"created_at":"2013-06-30T01:06:43.000Z","updated_at":"2026-04-02T19:37:49.000Z","published_at":"2013-06-30T01:06:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnyone want to play a card game?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards. Rows are the amount of people in play, columns are the amount of cards dealt to each person. The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J. The suits are s for spades, d for dimonds, h for hearts and c for clubs.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo the final cards look like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'js'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'J'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'2h'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'ad'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'5c' and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis function reads in three variables, these are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003epeople -- This is the amount of people that the cards are being dealt to.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ecardsDelt -- This is the amount of cards dealt to each person.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eisJokerIn -- This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso an example is the following, if the variables are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003epeople = 5;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ecardsDelt = 5; %note, this is a typical deal for a poker game...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eisJokerIn = 0;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe outputs will be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edealtDeck =\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    'qh'    'as'    '5s'     '2s'    'jd' \\n    'ad'    '5d'    '9s'     '7h'    'ah' \\n    '3c'    '2d'    'ac'     '8c'    'qd' \\n    'kh'    '5h'    '4c'     '3h'    '10s'\\n    '6h'    '8h'    '10c'    '4s'    '8d']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edeckLeftover =\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    '3s'\\n    '4h'\\n    '2c'\\n    '5c'\\n    'qs'\\n    'jh'\\n    'kd'\\n    '2h'\\n    '9c'\\n    '10h'\\n    '9h'\\n    '6d'\\n    '7c'\\n    '7s'\\n    '8s'\\n    'qc'\\n    'js'\\n    '9d'\\n    '7d'\\n    'ks'\\n    '6c'\\n    '6s'\\n    '3d'\\n    '10d'\\n    'jc'\\n    '4d'\\n    'kc']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWell I hope that everyone has fun with it! Thank you!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1512,"title":"Clock Solitaire","description":"Many card players will be familiar with the game of  \u003chttp://en.wikipedia.org/wiki/Clock_patience Clock Solitaire\u003e.  Briefly, the player sets up by creating thirteen piles of four face-down cards at random, each associated with one of the ranks ace through king.  Beginning with the top card in the king's pile, the player places the drawn card face up beneath its home pile, and draws a new card from the top of that same pile.  Play continues until the fourth king is drawn.  If all cards are face up in their home piles at this time, the game is a winner.\r\n\r\nSince clock solitaire is a purely deterministic game, a computer can easily be programmed to play.  For this problem, you will write a function that takes a deck and reports whether or not it is a winning configuration.  More specifically, the input will be some permutation of the integers 1:52, where 1:13 represent the ace through king of clubs, 14:26 the ace through king of diamonds, 27:39 the hearts, and 40:52 the spades.  Assume that the cards are formed into 13 piles by taking the first four cards as the ace pile, next four as the deuce pile, etc.  Output is a single scalar boolean indicating whether the game will be won using this deck.\r\n\r\nArmed with this function, one can determine empirically what the win rate is for randomly shuffled decks.  See if you can find out!","description_html":"\u003cp\u003eMany card players will be familiar with the game of  \u003ca href = \"http://en.wikipedia.org/wiki/Clock_patience\"\u003eClock Solitaire\u003c/a\u003e.  Briefly, the player sets up by creating thirteen piles of four face-down cards at random, each associated with one of the ranks ace through king.  Beginning with the top card in the king's pile, the player places the drawn card face up beneath its home pile, and draws a new card from the top of that same pile.  Play continues until the fourth king is drawn.  If all cards are face up in their home piles at this time, the game is a winner.\u003c/p\u003e\u003cp\u003eSince clock solitaire is a purely deterministic game, a computer can easily be programmed to play.  For this problem, you will write a function that takes a deck and reports whether or not it is a winning configuration.  More specifically, the input will be some permutation of the integers 1:52, where 1:13 represent the ace through king of clubs, 14:26 the ace through king of diamonds, 27:39 the hearts, and 40:52 the spades.  Assume that the cards are formed into 13 piles by taking the first four cards as the ace pile, next four as the deuce pile, etc.  Output is a single scalar boolean indicating whether the game will be won using this deck.\u003c/p\u003e\u003cp\u003eArmed with this function, one can determine empirically what the win rate is for randomly shuffled decks.  See if you can find out!\u003c/p\u003e","function_template":"function isWinner = clockSolitaire(deck)\r\n  isWinner = true;\r\nend","test_suite":"%%\r\ndeck = [1:52];\r\nassert(isequal(clockSolitaire(deck),false))\r\n\r\n%%\r\ndeck = [8 1 5 2 30 23 46 21 3 51 6 27 42 48 37 33 12 25 45 36 31 34 29 35 15 17 43 13 39 40 18 50 26 9 4 28 38 16 11 22 49 24 14 7 32 20 47 44 19 10 41 52];\r\nassert(isequal(clockSolitaire(deck),true))\r\n%%\r\ndeck = [52:-1:1];\r\nassert(isequal(clockSolitaire(deck),false))\r\n\r\n%%\r\ndeck = [40 29 25 37 23 41 13 50 33 2 42 20 49 48 27 46 36 45 28 1 7 11 14 5 9 26 15 21 12 8 19 35 10 38 34 52 32 51 31 16 18 22 6 3 47 44 43 4 24 17 30 39];\r\nassert(isequal(clockSolitaire(deck),true))\r\n\r\n%%\r\ndeck = [40 29 25 37 23 41 13 50 33 2 42 20 52 48 27 46 36 45 28 1 7 11 14 5 9 26 15 21 12 8 19 35 10 38 34 49 32 51 31 16 18 22 6 3 47 44 43 4 24 17 30 39];\r\nassert(isequal(clockSolitaire(deck),false))\r\n\r\n%%\r\ndeck = [8 1 5 2 30 23 46 21 3 51 6 27 13 48 37 33 12 25 45 36 31 34 29 35 15 17 43 42 39 40 18 50 26 9 4 28 38 16 11 22 49 24 14 7 32 20 47 44 19 10 41 52];\r\nassert(isequal(clockSolitaire(deck),false))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":3117,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":39,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":15,"created_at":"2013-05-16T01:27:06.000Z","updated_at":"2026-02-15T04:05:23.000Z","published_at":"2013-05-16T01:27:05.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMany card players will be familiar with the game of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Clock_patience\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eClock Solitaire\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Briefly, the player sets up by creating thirteen piles of four face-down cards at random, each associated with one of the ranks ace through king. Beginning with the top card in the king's pile, the player places the drawn card face up beneath its home pile, and draws a new card from the top of that same pile. Play continues until the fourth king is drawn. If all cards are face up in their home piles at this time, the game is a winner.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSince clock solitaire is a purely deterministic game, a computer can easily be programmed to play. For this problem, you will write a function that takes a deck and reports whether or not it is a winning configuration. More specifically, the input will be some permutation of the integers 1:52, where 1:13 represent the ace through king of clubs, 14:26 the ace through king of diamonds, 27:39 the hearts, and 40:52 the spades. Assume that the cards are formed into 13 piles by taking the first four cards as the ace pile, next four as the deuce pile, etc. Output is a single scalar boolean indicating whether the game will be won using this deck.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eArmed with this function, one can determine empirically what the win rate is for randomly shuffled decks. See if you can find out!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":391,"title":"Poker Series 11: selectBestHand","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nSelect the best hand using the definitions from earlier in this series.\r\n\r\n  out.hm{1} = cards used from the first hand matrix;\r\n  out.hm{2} = cards used from the second hand matrix;   \r\n  out.winner = 1,2 or zero for a tie;\r\n\r\n\r\nStandard poker ranks apply: Straight flush is best, high card is worst, with many gradations within each rank.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eSelect the best hand using the definitions from earlier in this series.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eout.hm{1} = cards used from the first hand matrix;\r\nout.hm{2} = cards used from the second hand matrix;   \r\nout.winner = 1,2 or zero for a tie;\r\n\u003c/pre\u003e\u003cp\u003eStandard poker ranks apply: Straight flush is best, high card is worst, with many gradations within each rank.\u003c/p\u003e","function_template":"function out = selectBestHand(hm1, hm2)\r\n\r\n%winner is 1,2 or 0 is tie, even if both have no valid hand\r\n\r\nout.hm{1}  = false(4,13);\r\nout.hm{2}  = false(4,13);\r\nout.winner = 0;","test_suite":"%%\r\nhm1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\nom1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n   \r\nhm2 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 0;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n\r\n%%\r\nhm1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\nom1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n   \r\nhm2 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0\r\n       0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0\r\n       0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 2;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n%%\r\nhm1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\nom1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0\r\n       0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0];\r\n   \r\nhm2 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 1 0 0 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 1 0 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 1;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n%%\r\nhm1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\nom1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0\r\n       0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0];\r\n   \r\nhm2 = [0 1 0 0 0 0 0 0 0 0 0 1 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0\r\n       0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 1 0 0 0 0 0 0 0 0 0 1 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0\r\n       0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 1;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n%%\r\nhm1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 1 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\nom1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n   \r\nhm2 = [0 1 0 0 0 0 0 0 0 0 0 1 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 1 0\r\n       0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 1 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 1 0 0 0 0 0 0 0 0 0 1 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 1 0\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 1;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n\r\n%%\r\nhm1 = [1 1 1 1 1 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 1 0 0 0 0 0 0 0 1\r\n       0 0 0 1 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\nom1 = [1 1 1 1 1 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n   \r\nhm2 = [0 1 0 0 0 0 0 0 0 0 0 1 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 1 0\r\n       0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 1 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 1 0 0 0 0 0 0 0 0 0 1 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 1 0\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 1;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n\r\n%%\r\nhm1 = [1 1 1 1 1 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 1 0 0 0 0 0 0 0 1\r\n       0 0 0 1 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\nom1 = [1 1 1 1 1 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n   \r\nhm2 = [1 1 1 1 1 1 0 0 0 0 0 1 1 \r\n       0 0 0 0 0 0 0 0 0 0 0 1 0\r\n       0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 1 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 1 1 1 1 1 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 2;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n\r\n%%\r\nhm1 = [0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 1 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\nom1 = [0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n   \r\nhm2 = [0 0 0 0 1 1 0 0 0 0 0 1 1 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 1 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 0 0 0 1 0 0 0 0 0 0 1 1 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0\r\n       0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 1 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 2;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n%%\r\nhm1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 1 0 0 1 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\nom1 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n   \r\nhm2 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 0 0 0 1 0 0 0 0 1 0 \r\n       0 0 0 0 1 0 0 0 0 0 0 0 0];  \r\n   \r\nom2 = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n       0 1 0 0 0 0 0 0 0 0 0 0 1\r\n       0 0 0 0 0 0 0 0 0 0 0 1 0 \r\n       0 0 0 0 0 0 0 0 0 0 0 0 0];   \r\n\r\nout.hm{1} = om1;\r\nout.hm{2} = om2;   \r\nout.winner = 2;\r\n\r\nassert(isequal(selectBestHand(hm1,hm2),out))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":16,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":37,"test_suite_updated_at":"2016-12-13T18:59:04.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-23T16:55:58.000Z","updated_at":"2026-02-15T04:12:40.000Z","published_at":"2012-02-23T20:20:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSelect the best hand using the definitions from earlier in this series.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[out.hm{1} = cards used from the first hand matrix;\\nout.hm{2} = cards used from the second hand matrix;   \\nout.winner = 1,2 or zero for a tie;]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStandard poker ranks apply: Straight flush is best, high card is worst, with many gradations within each rank.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":386,"title":"Poker Series 10: bestHand","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nFind the best hand using the definitions from earlier in this series.\r\n\r\nout.code is:\r\n\r\n# Straight Flush\r\n# Quads\r\n# Full House\r\n# Flush\r\n# Straight\r\n# Three of a kind\r\n# Two pair\r\n# Pair\r\n# High Card\r\n# No valid Hand\r\n\r\nout.cardsUsed is the same as is returned from the functions defined earlier for each type of hand.\r\n\r\nThis hand matrix:\r\n\r\n  0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 0 0\r\n  0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n  0 1 0 0 0 1 0 0 0 0 0 0 0\r\n\r\nrepresents a three of a kind, so the return code is 6.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eFind the best hand using the definitions from earlier in this series.\u003c/p\u003e\u003cp\u003eout.code is:\u003c/p\u003e\u003col\u003e\u003cli\u003eStraight Flush\u003c/li\u003e\u003cli\u003eQuads\u003c/li\u003e\u003cli\u003eFull House\u003c/li\u003e\u003cli\u003eFlush\u003c/li\u003e\u003cli\u003eStraight\u003c/li\u003e\u003cli\u003eThree of a kind\u003c/li\u003e\u003cli\u003eTwo pair\u003c/li\u003e\u003cli\u003ePair\u003c/li\u003e\u003cli\u003eHigh Card\u003c/li\u003e\u003cli\u003eNo valid Hand\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eout.cardsUsed is the same as is returned from the functions defined earlier for each type of hand.\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0\r\n0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n0 1 0 0 0 1 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003erepresents a three of a kind, so the return code is 6.\u003c/p\u003e","function_template":"function out = bestPokerHand(hm)\r\n\r\nout.code      = 10;\r\nout.usedCards = false(4,13); ","test_suite":"%%\r\nhm = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 0 0\r\n      0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.code = 10;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n      0 0 0 0 1 0 0 0 0 0 0 1 0\r\n      0 0 0 1 0 0 1 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 1 0 0 0];\r\n\r\ny_correct.code = 9;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 1 \r\n                               0 0 0 0 1 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 1 0 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 0 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 1 0 0];\r\n\r\ny_correct.code = 8;\r\ny_correct.usedCards = logical([0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n                               0 1 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 0 1 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 0 0\r\n      0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n      1 0 0 1 0 0 0 0 0 0 1 0 0];\r\n\r\ny_correct.code = 7;\r\ny_correct.usedCards = logical([0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 1 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 1 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n      0 0 0 0 0 0 1 0 0 0 0 0 0\r\n      0 0 0 1 0 0 1 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 1 0 0 0 0 1 0];\r\n\r\ny_correct.code = 6;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 1 \r\n                               0 0 0 0 0 0 1 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 1 0 0 0 0 1 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n      1 1 0 0 0 0 0 0 0 0 0 0 0\r\n      0 0 1 1 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 1 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.code = 5;\r\ny_correct.usedCards = logical([0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 1 1 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 1 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.code = 4;\r\ny_correct.usedCards = logical([0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 0 \r\n      0 1 0 0 0 0 0 0 0 0 0 1 0\r\n      0 1 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.code = 3;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 1 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 0 1 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.code = 2;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 0 1 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 1 1 1 1 1 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.code = 1;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 1 1 1 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(bestPokerHand(hm),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":18,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":44,"test_suite_updated_at":"2016-12-13T18:56:05.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-22T20:58:19.000Z","updated_at":"2026-02-15T04:18:26.000Z","published_at":"2012-02-22T20:58:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the best hand using the definitions from earlier in this series.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eout.code is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStraight Flush\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eQuads\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFull House\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFlush\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStraight\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThree of a kind\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTwo pair\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePair\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHigh Card\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNo valid Hand\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eout.cardsUsed is the same as is returned from the functions defined earlier for each type of hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 1 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0\\n0 1 0 1 0 0 0 0 0 0 0 0 0 \\n0 1 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a three of a kind, so the return code is 6.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":385,"title":"Poker Series 09: IsHighCard","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nHigh Card is the five highest cards in your hand.  It is basically what you have if you don't have anything else!  The Ace (first column) is highest.  The columns represent A, 2, 3, ... K.  If the kickers also form a pair, it is still considered high card for the purposes of this function.\r\n\r\nThis hand matrix:\r\n\r\n  0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 0 0\r\n  0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n  0 1 0 0 0 1 0 0 0 0 0 0 0\r\n\r\nrepresents a high card, so the return value from the function is TRUE.\r\n\r\nThis hand matrix does not (because it is defined as five cards):\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\r\nso the return value should be FALSE.\r\n\r\nThis hand matrix does represent a high card\r\n\r\n  0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n  0 0 0 0 0 0 0 0 0 0 1 0 0\r\n  0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n  0 0 0 0 0 1 0 0 0 1 0 1 0\r\n\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\r\n  0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 1 1 1 0 0 0 0 0 1\r\n  0 0 0 1 0 1 0 0 0 1 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 1 0 \r\n\r\nWould be TRUE for this function.\r\n\r\nA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the high card.  If more than one hag card can be made, return the higher ranking one (the one with the highest rank.  Ace being the highest).  If different suits are possible for the same high card, return the one higher up in the matrix, same for kickers.  If the high card also happens to also be a four of a kind or full house, it still meets the defintion and should be returned.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eHigh Card is the five highest cards in your hand.  It is basically what you have if you don't have anything else!  The Ace (first column) is highest.  The columns represent A, 2, 3, ... K.  If the kickers also form a pair, it is still considered high card for the purposes of this function.\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0\r\n0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n0 1 0 0 0 1 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003erepresents a high card, so the return value from the function is TRUE.\u003c/p\u003e\u003cp\u003eThis hand matrix does not (because it is defined as five cards):\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eso the return value should be FALSE.\u003c/p\u003e\u003cp\u003eThis hand matrix does represent a high card\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n0 0 0 0 0 0 0 0 0 0 1 0 0\r\n0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n0 0 0 0 0 1 0 0 0 1 0 1 0\r\n\u003c/pre\u003e\u003cp\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n0 0 0 0 1 1 1 0 0 0 0 0 1\r\n0 0 0 1 0 1 0 0 0 1 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 1 0 \r\n\u003c/pre\u003e\u003cp\u003eWould be TRUE for this function.\u003c/p\u003e\u003cp\u003eA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the high card.  If more than one hag card can be made, return the higher ranking one (the one with the highest rank.  Ace being the highest).  If different suits are possible for the same high card, return the one higher up in the matrix, same for kickers.  If the high card also happens to also be a four of a kind or full house, it still meets the defintion and should be returned.\u003c/p\u003e","function_template":"function out = isHighCard(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"clear\r\nclc\r\n\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isHighCard(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      1 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 1 0 1 1 \r\n                               1 0 0 0 0 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isHighCard(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      1 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 1 1 \r\n                               1 0 0 0 0 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isHighCard(hm),y_correct))\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 0 1 0\r\n      0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isHighCard(hm),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":55,"test_suite_updated_at":"2012-02-22T19:38:00.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-22T19:38:00.000Z","updated_at":"2026-02-15T05:43:12.000Z","published_at":"2012-02-22T19:48:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHigh Card is the five highest cards in your hand. It is basically what you have if you don't have anything else! The Ace (first column) is highest. The columns represent A, 2, 3, ... K. If the kickers also form a pair, it is still considered high card for the purposes of this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 1 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0\\n0 1 0 1 0 0 0 0 0 0 0 0 0 \\n0 1 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a high card, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not (because it is defined as five cards):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a high card\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 0 0 0 0 1 0 0 1 \\n0 0 0 0 0 0 0 0 0 0 1 0 0\\n0 0 0 0 0 0 0 0 0 1 0 0 0 \\n0 0 0 0 0 1 0 0 0 1 0 1 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 1 0 0 0 0 0 0 0 \\n0 0 0 0 1 1 1 0 0 0 0 0 1\\n0 0 0 1 0 1 0 0 0 1 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 1 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be TRUE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand matrix, but it only shows the cards used to make the high card. If more than one hag card can be made, return the higher ranking one (the one with the highest rank. Ace being the highest). If different suits are possible for the same high card, return the one higher up in the matrix, same for kickers. If the high card also happens to also be a four of a kind or full house, it still meets the defintion and should be returned.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":384,"title":"Poker Series 08: IsPair","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nA pair is 2 cards of the same rank (column) and the three kickers.  The Ace (first column) is highest.  The columns represent A, 2, 3, ... K.  The next three highest cards are the kickers.  If the kickers also form a pair, or three of a kind, it is still considered a pair for the purposes of this function.\r\n\r\nThis hand matrix:\r\n\r\n  0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 1 0 0 0 0 0\r\n  0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\r\nrepresents a pair, so the return value from the function is TRUE.\r\n\r\nThis hand matrix does not:\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\r\nso the return value should be FALSE.\r\n\r\nThis hand matrix does represent a pair\r\n\r\n  0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n  0 0 0 0 0 0 0 0 0 0 1 0 0\r\n  0 0 1 0 0 0 0 0 0 1 0 0 0 \r\n  0 0 0 0 0 1 0 0 0 0 0 1 0\r\n\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\r\n  0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 1 1 1 0 0 0 1 0 1\r\n  0 0 0 1 0 1 0 0 0 1 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 1 0 \r\n\r\nWould be TRUE for this function.\r\n\r\nA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the pair.  If more than one pair can be made, return the higher ranking one (the one with the highest rank.  Ace being the highest).  If different suits are possible for the same pair, return the one higher up in the matrix, same for kickers.  If the pair happens to also be a four of a kind or full house, two pair, etc.. it still meets the defintion and should be returned.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eA pair is 2 cards of the same rank (column) and the three kickers.  The Ace (first column) is highest.  The columns represent A, 2, 3, ... K.  The next three highest cards are the kickers.  If the kickers also form a pair, or three of a kind, it is still considered a pair for the purposes of this function.\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 1 0 0 0 0 0\r\n0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003erepresents a pair, so the return value from the function is TRUE.\u003c/p\u003e\u003cp\u003eThis hand matrix does not:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eso the return value should be FALSE.\u003c/p\u003e\u003cp\u003eThis hand matrix does represent a pair\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n0 0 0 0 0 0 0 0 0 0 1 0 0\r\n0 0 1 0 0 0 0 0 0 1 0 0 0 \r\n0 0 0 0 0 1 0 0 0 0 0 1 0\r\n\u003c/pre\u003e\u003cp\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 1 1 1 0 0 0 1 0 1\r\n0 0 0 1 0 1 0 0 0 1 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 1 0 \r\n\u003c/pre\u003e\u003cp\u003eWould be TRUE for this function.\u003c/p\u003e\u003cp\u003eA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the pair.  If more than one pair can be made, return the higher ranking one (the one with the highest rank.  Ace being the highest).  If different suits are possible for the same pair, return the one higher up in the matrix, same for kickers.  If the pair happens to also be a four of a kind or full house, two pair, etc.. it still meets the defintion and should be returned.\u003c/p\u003e","function_template":"function out = isPair(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"%%\r\nhm = [0 1 0 0 0 0 0 0 1 0 0 0 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 1 0\r\n      0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 1 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n                               0 1 0 0 0 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 1 0 0])\r\n                           \r\nassert(isequal(isPair(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 0 0 0 1 \r\n      0 1 0 0 0 0 0 1 0 0 0 1 0\r\n      0 0 0 0 0 0 1 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 1 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 1 0 0 0 0 0 0 0 0 0 0 1 \r\n                               0 1 0 0 0 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 1 0 0])\r\n                           \r\nassert(isequal(isPair(hm),y_correct))\r\n\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 0 0 0 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 1 1\r\n      0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 1 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 0 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 1 1\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 1 0 0])\r\n                           \r\nassert(isequal(isPair(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 0 0 0 1 \r\n      1 1 0 0 0 0 0 0 0 0 0 1 0\r\n      0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 1 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 1 \r\n                               1 0 0 0 0 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 0 1 0 0])\r\n                           \r\nassert(isequal(isPair(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 0 0 0 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 1 0\r\n      0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 1 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isPair(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 0 0 0 1 \r\n      1 1 0 0 0 0 0 0 0 0 0 1 1\r\n      0 0 0 0 0 0 0 0 0 0 0 0 1 \r\n      1 0 0 0 0 0 0 0 0 0 1 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 1 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 1\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 1 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isPair(hm),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":55,"test_suite_updated_at":"2012-02-22T19:17:35.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-22T19:17:35.000Z","updated_at":"2026-02-15T05:44:51.000Z","published_at":"2012-02-22T19:17:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA pair is 2 cards of the same rank (column) and the three kickers. The Ace (first column) is highest. The columns represent A, 2, 3, ... K. The next three highest cards are the kickers. If the kickers also form a pair, or three of a kind, it is still considered a pair for the purposes of this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 1 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 1 0 0 0 0 0\\n0 1 0 1 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a pair, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 1 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a pair\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 0 0 0 0 1 0 0 1 \\n0 0 0 0 0 0 0 0 0 0 1 0 0\\n0 0 1 0 0 0 0 0 0 1 0 0 0 \\n0 0 0 0 0 1 0 0 0 0 0 1 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 1 1 1 0 0 0 1 0 1\\n0 0 0 1 0 1 0 0 0 1 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 1 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be TRUE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand matrix, but it only shows the cards used to make the pair. If more than one pair can be made, return the higher ranking one (the one with the highest rank. Ace being the highest). If different suits are possible for the same pair, return the one higher up in the matrix, same for kickers. If the pair happens to also be a four of a kind or full house, two pair, etc.. it still meets the defintion and should be returned.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":383,"title":"Poker Series 07: IsTwoPair","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nA two pair is two pairs of cards of the same rank (column).  The Ace (first column) is highest.  The columns represent A, 2, 3, ... K.  The next highest card is the kicker.  If the kicker also form three of a kind with a pair, it is still considered two pair for the purposes of this function.  Four of a kind is still two pair also.  (I got two pair, a pair of Aces and another Pair of Aces!)\r\n\r\nThis hand matrix:\r\n\r\n  0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 1 0 0 0\r\n  0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 1 1 0 0 1 0 0 0 0\r\n\r\nrepresents a two pair, so the return value from the function is TRUE.\r\n\r\nThis hand matrix does not:\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\r\nso the return value should be FALSE.\r\n\r\nThis hand matrix does represent a two pair\r\n\r\n  0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n  0 0 1 0 0 0 0 0 0 0 1 0 1\r\n  0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n  0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\r\n  0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n  0 1 0 0 1 1 1 0 0 0 0 1 0\r\n  0 1 0 1 0 0 0 0 0 1 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 1 0 \r\n\r\nWould be TRUE for this function.\r\n\r\nA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the three of a kind.  If more than one two pair can be made, return the higher ranking one (the one with the highest rank.  Ace being the highest).  If different suits are possible for the same pair, return the ones higher up in the matrix, same for kickers.  If the two pair happens to also be a four of a kind or full house, it still meets the defintion and should be returned.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eA two pair is two pairs of cards of the same rank (column).  The Ace (first column) is highest.  The columns represent A, 2, 3, ... K.  The next highest card is the kicker.  If the kicker also form three of a kind with a pair, it is still considered two pair for the purposes of this function.  Four of a kind is still two pair also.  (I got two pair, a pair of Aces and another Pair of Aces!)\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 1 0 0 0\r\n0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 1 1 0 0 1 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003erepresents a two pair, so the return value from the function is TRUE.\u003c/p\u003e\u003cp\u003eThis hand matrix does not:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eso the return value should be FALSE.\u003c/p\u003e\u003cp\u003eThis hand matrix does represent a two pair\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n0 0 1 0 0 0 0 0 0 0 1 0 1\r\n0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n0 1 0 0 1 1 1 0 0 0 0 1 0\r\n0 1 0 1 0 0 0 0 0 1 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 1 0 \r\n\u003c/pre\u003e\u003cp\u003eWould be TRUE for this function.\u003c/p\u003e\u003cp\u003eA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the three of a kind.  If more than one two pair can be made, return the higher ranking one (the one with the highest rank.  Ace being the highest).  If different suits are possible for the same pair, return the ones higher up in the matrix, same for kickers.  If the two pair happens to also be a four of a kind or full house, it still meets the defintion and should be returned.\u003c/p\u003e","function_template":"function out = isTwoPair(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 0 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 1 0 0 0 0 0 0 1 0 0 0 1 \r\n                               0 1 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isTwoPair(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 0 0 \r\n      0 1 0 0 0 0 0 0 0 0 0 0 0\r\n      1 0 0 1 0 0 0 0 1 1 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 1 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               1 0 0 0 0 0 0 0 0 1 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isTwoPair(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 0 1 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0\r\n      0 0 0 1 0 0 0 0 1 1 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isTwoPair(hm),y_correct))\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 0 0 \r\n      0 1 0 0 0 0 0 0 0 1 0 0 0\r\n      1 0 0 1 0 0 0 0 1 1 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 1 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 1 0 0 0\r\n                               1 0 0 0 0 0 0 0 0 1 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isTwoPair(hm),y_correct))\r\n\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 0 0 \r\n      0 1 0 0 0 0 0 0 0 1 0 0 0\r\n      1 0 0 1 0 0 0 0 1 1 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 1 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 1 0 0 0\r\n                               1 0 0 0 0 0 0 0 0 1 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 1 0 0 0])\r\n                           \r\nassert(isequal(isTwoPair(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 0 0 0\r\n      1 0 0 0 0 0 0 0 0 1 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isTwoPair(hm),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":"2012-02-22T17:28:05.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-22T17:28:05.000Z","updated_at":"2026-02-15T05:47:26.000Z","published_at":"2012-02-22T17:28:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA two pair is two pairs of cards of the same rank (column). The Ace (first column) is highest. The columns represent A, 2, 3, ... K. The next highest card is the kicker. If the kicker also form three of a kind with a pair, it is still considered two pair for the purposes of this function. Four of a kind is still two pair also. (I got two pair, a pair of Aces and another Pair of Aces!)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 1 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 1 0 0 0\\n0 1 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 1 1 0 0 1 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a two pair, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 1 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a two pair\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 0 0 0 0 1 0 0 1 \\n0 0 1 0 0 0 0 0 0 0 1 0 1\\n0 0 0 0 0 0 0 0 0 1 0 0 0 \\n0 0 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 1 0 0 0 0 0 0 0 \\n0 1 0 0 1 1 1 0 0 0 0 1 0\\n0 1 0 1 0 0 0 0 0 1 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 1 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be TRUE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand matrix, but it only shows the cards used to make the three of a kind. If more than one two pair can be made, return the higher ranking one (the one with the highest rank. Ace being the highest). If different suits are possible for the same pair, return the ones higher up in the matrix, same for kickers. If the two pair happens to also be a four of a kind or full house, it still meets the defintion and should be returned.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":377,"title":"Poker Series 06: isThreeKind","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nA three of a kind is 3 cards of the same rank (column).  The Ace (first column) is highest.  The columns represent A, 2, 3, ... K.  The next two highest cards are the kickers.  If the kickers also form a pair, it is still considered three of a kind for the purposes of this function.\r\n\r\nThis hand matrix:\r\n\r\n  0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 0 0\r\n  0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n  0 1 0 0 0 1 0 0 0 0 0 0 0\r\n\r\nrepresents a three of a kind, so the return value from the function is TRUE.\r\n\r\nThis hand matrix does not:\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\r\nso the return value should be FALSE.\r\n\r\nThis hand matrix does represent a three of a kind\r\n\r\n  0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n  0 0 0 0 0 0 0 0 0 0 1 0 0\r\n  0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n  0 0 0 0 0 1 0 0 0 1 0 1 0\r\n\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\r\n  0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 1 1 1 0 0 0 0 0 1\r\n  0 0 0 1 0 1 0 0 0 1 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 1 0 \r\n\r\nWould be TRUE for this function.\r\n\r\nA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the three of a kind.  If more than one three of a kind can be made, return the higher ranking one (the one with the highest rank.  Ace being the highest).  If different suits are possible for the same three of a kind cards, return the one higher up in the matrix, same for kickers.  If the three of a kind happens to also be a four of a kind or full house, it still meets the defintion and should be returned.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eA three of a kind is 3 cards of the same rank (column).  The Ace (first column) is highest.  The columns represent A, 2, 3, ... K.  The next two highest cards are the kickers.  If the kickers also form a pair, it is still considered three of a kind for the purposes of this function.\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0\r\n0 1 0 1 0 0 0 0 0 0 0 0 0 \r\n0 1 0 0 0 1 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003erepresents a three of a kind, so the return value from the function is TRUE.\u003c/p\u003e\u003cp\u003eThis hand matrix does not:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eso the return value should be FALSE.\u003c/p\u003e\u003cp\u003eThis hand matrix does represent a three of a kind\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n0 0 0 0 0 0 0 0 0 0 1 0 0\r\n0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n0 0 0 0 0 1 0 0 0 1 0 1 0\r\n\u003c/pre\u003e\u003cp\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n0 0 0 0 1 1 1 0 0 0 0 0 1\r\n0 0 0 1 0 1 0 0 0 1 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 1 0 \r\n\u003c/pre\u003e\u003cp\u003eWould be TRUE for this function.\u003c/p\u003e\u003cp\u003eA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the three of a kind.  If more than one three of a kind can be made, return the higher ranking one (the one with the highest rank.  Ace being the highest).  If different suits are possible for the same three of a kind cards, return the one higher up in the matrix, same for kickers.  If the three of a kind happens to also be a four of a kind or full house, it still meets the defintion and should be returned.\u003c/p\u003e","function_template":"function out = isThreeKind(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 1 1 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isThreeKind(hm),y_correct))\r\n\r\n%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 0 0\r\n      1 0 0 1 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 0 1 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0\r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0])\r\n                           \r\nassert(isequal(isThreeKind(hm),y_correct))\r\n\r\n%%\r\nhm = [1 1 0 0 0 0 0 0 1 1 0 0 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      1 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      1 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([1 0 0 0 0 0 0 0 0 0 0 0 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 1 0\r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isThreeKind(hm),y_correct))\r\n\r\n%%\r\nhm = [1 1 0 0 0 0 0 0 1 1 0 0 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      1 0 0 1 0 0 0 0 1 0 0 0 1 \r\n      1 0 0 0 0 0 0 0 0 0 0 0 1];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([1 0 0 0 0 0 0 0 0 0 0 0 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               1 0 0 0 0 0 0 0 0 0 0 0 1 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isThreeKind(hm),y_correct))\r\n\r\n%%\r\nhm = [1 1 0 0 0 0 0 0 1 1 0 0 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 1 0\r\n      1 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isThreeKind(hm),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":56,"test_suite_updated_at":"2012-02-21T21:50:59.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-21T21:17:05.000Z","updated_at":"2026-02-15T05:49:06.000Z","published_at":"2012-02-22T17:26:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA three of a kind is 3 cards of the same rank (column). The Ace (first column) is highest. The columns represent A, 2, 3, ... K. The next two highest cards are the kickers. If the kickers also form a pair, it is still considered three of a kind for the purposes of this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 1 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0\\n0 1 0 1 0 0 0 0 0 0 0 0 0 \\n0 1 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a three of a kind, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 1 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a three of a kind\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 0 0 0 0 1 0 0 1 \\n0 0 0 0 0 0 0 0 0 0 1 0 0\\n0 0 0 0 0 0 0 0 0 1 0 0 0 \\n0 0 0 0 0 1 0 0 0 1 0 1 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 1 0 0 0 0 0 0 0 \\n0 0 0 0 1 1 1 0 0 0 0 0 1\\n0 0 0 1 0 1 0 0 0 1 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 1 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be TRUE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand matrix, but it only shows the cards used to make the three of a kind. If more than one three of a kind can be made, return the higher ranking one (the one with the highest rank. Ace being the highest). If different suits are possible for the same three of a kind cards, return the one higher up in the matrix, same for kickers. If the three of a kind happens to also be a four of a kind or full house, it still meets the defintion and should be returned.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":376,"title":"Poker Series 05: isStraight","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nA straight is 5 cards of the adjacent ranks (columns) regardless of suits (rows).  The Ace (first column) is both lowest and highest.  The columns represent A, 2, 3, ... K.  This means A, K, Q, J, Ten is a straight also.\r\n\r\nThis hand matrix:\r\n\r\n  0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 0 0\r\n  0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\r\nrepresents a straight, so the return value from the function is TRUE.\r\n\r\nThis hand matrix does not:\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\r\nso the return value should be FALSE.\r\n\r\nThis hand matrix does represent a straight\r\n\r\n  0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n  0 0 0 0 0 0 0 0 0 0 1 0 0\r\n  0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n  1 0 0 0 0 1 0 0 0 0 0 1 0\r\n\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\r\n  0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 1 0 1 0 0 0 0 0 0\r\n  0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n\r\nWould be TRUE for this function.\r\n\r\nA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the straight.  If more than one straight can be made, return the higher ranking one (the one with the highest top card.  Ace being the highest).  If different suits are possible for the same straight cards, return the one higher up in the matrix.  If the straight happens to also be a straight flush, it still meets the defintion and should be returned.  The highest straight should be returned, even if a straight flush can also be made.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eA straight is 5 cards of the adjacent ranks (columns) regardless of suits (rows).  The Ace (first column) is both lowest and highest.  The columns represent A, 2, 3, ... K.  This means A, K, Q, J, Ten is a straight also.\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 1 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003erepresents a straight, so the return value from the function is TRUE.\u003c/p\u003e\u003cp\u003eThis hand matrix does not:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 1 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eso the return value should be FALSE.\u003c/p\u003e\u003cp\u003eThis hand matrix does represent a straight\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 0 0 0 0 1 0 0 1 \r\n0 0 0 0 0 0 0 0 0 0 1 0 0\r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n1 0 0 0 0 1 0 0 0 0 0 1 0\r\n\u003c/pre\u003e\u003cp\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n0 0 0 0 1 0 1 0 0 0 0 0 0\r\n0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n\u003c/pre\u003e\u003cp\u003eWould be TRUE for this function.\u003c/p\u003e\u003cp\u003eA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the straight.  If more than one straight can be made, return the higher ranking one (the one with the highest top card.  Ace being the highest).  If different suits are possible for the same straight cards, return the one higher up in the matrix.  If the straight happens to also be a straight flush, it still meets the defintion and should be returned.  The highest straight should be returned, even if a straight flush can also be made.\u003c/p\u003e","function_template":"function out = isStraight(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isStraight(hm),y_correct))\r\n\r\n%%\r\nhm = [0 1 1 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 1 0 0 0 0 0 0 0\r\n      0 0 0 1 0 0 0 0 0 1 0 1 0 \r\n      0 0 0 0 1 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 1 1 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 1 0 0 0 0 0 0 0\r\n                               0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 1 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isStraight(hm),y_correct))\r\n\r\n%%\r\nhm = [0 1 1 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 1 0 0 0 0 0 0 0\r\n      0 1 0 1 0 0 0 0 0 1 0 1 0 \r\n      0 0 0 0 1 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 1 1 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 1 0 0 0 0 0 0 0\r\n                               0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 1 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isStraight(hm),y_correct))\r\n\r\n%%\r\nhm = [0 1 1 0 0 0 0 0 0 0 0 0 0 \r\n      1 0 0 0 0 1 0 0 0 0 0 0 0\r\n      0 1 0 1 0 0 0 0 0 1 0 1 0 \r\n      0 0 0 0 1 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 1 1 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 1 0 0 0 0 0 0 0\r\n                               0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 1 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isStraight(hm),y_correct))\r\n\r\n%%\r\nhm = [0 1 1 0 0 0 0 0 0 0 1 0 0 \r\n      0 0 0 0 0 1 0 0 0 0 0 0 1\r\n      0 1 0 1 0 0 0 0 0 1 0 1 0 \r\n      1 0 0 0 1 0 0 0 0 0 0 0 1];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 1 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 1\r\n                               0 0 0 0 0 0 0 0 0 1 0 1 0 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isStraight(hm),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":62,"test_suite_updated_at":"2012-02-21T19:24:51.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-21T19:24:51.000Z","updated_at":"2026-02-15T05:51:00.000Z","published_at":"2012-02-21T19:50:10.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA straight is 5 cards of the adjacent ranks (columns) regardless of suits (rows). The Ace (first column) is both lowest and highest. The columns represent A, 2, 3, ... K. This means A, K, Q, J, Ten is a straight also.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 1 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0\\n0 0 0 1 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a straight, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 1 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a straight\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 0 0 0 0 1 0 0 1 \\n0 0 0 0 0 0 0 0 0 0 1 0 0\\n0 0 1 0 0 0 0 0 0 0 0 0 0 \\n1 0 0 0 0 1 0 0 0 0 0 1 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 0 0 0 0 1 0 0 0 0 0 0 0 \\n0 0 0 0 1 0 1 0 0 0 0 0 0\\n0 0 0 1 0 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be TRUE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand matrix, but it only shows the cards used to make the straight. If more than one straight can be made, return the higher ranking one (the one with the highest top card. Ace being the highest). If different suits are possible for the same straight cards, return the one higher up in the matrix. If the straight happens to also be a straight flush, it still meets the defintion and should be returned. The highest straight should be returned, even if a straight flush can also be made.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":335,"title":"Poker Series 04: isFlush","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nA flush is 5 cards of the same suit (row).  If there are more than five cards in a suit to choose from, the highest five count. The Ace (first column) is the highest.  The columns represent A, 2, 3, ... K.\r\n\r\nThis hand matrix:\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 1 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\r\nrepresents a flush, so the return value from the function is TRUE.\r\n\r\nThis hand matrix does not:\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 1 0 0 0 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\r\nso the return value should be FALSE.\r\n\r\nThis hand matrix does represent a flush\r\n\r\n  1 0 0 0 0 0 0 0 0 1 1 1 1 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n  0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 1 0 1 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n\r\nWould be FALSE for this function.\r\n\r\nA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the flush.  If more than one flush can be made, return the higher ranking one (the one with the highest top card.  Ace being the highest- ties broken by the second, third, fourth, and then fifth card).  If different suits are possible for the same flush, return the one higher up in the matrix.  If the flush happens to also be a straight flush, it still meets the defintion and should be returned.  The highest flush should be returned, even if a straight flush can also be made.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eA flush is 5 cards of the same suit (row).  If there are more than five cards in a suit to choose from, the highest five count. The Ace (first column) is the highest.  The columns represent A, 2, 3, ... K.\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 1 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003erepresents a flush, so the return value from the function is TRUE.\u003c/p\u003e\u003cp\u003eThis hand matrix does not:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 1 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eso the return value should be FALSE.\u003c/p\u003e\u003cp\u003eThis hand matrix does represent a flush\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1 0 0 0 0 0 0 0 0 1 1 1 1 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 1 0 1 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n\u003c/pre\u003e\u003cp\u003eWould be FALSE for this function.\u003c/p\u003e\u003cp\u003eA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand matrix, but it only shows the cards used to make the flush.  If more than one flush can be made, return the higher ranking one (the one with the highest top card.  Ace being the highest- ties broken by the second, third, fourth, and then fifth card).  If different suits are possible for the same flush, return the one higher up in the matrix.  If the flush happens to also be a straight flush, it still meets the defintion and should be returned.  The highest flush should be returned, even if a straight flush can also be made.\u003c/p\u003e","function_template":"function out = isFlush(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"%%\r\nhm = [0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 1 0 0 0 0 0 0 1 1 0 1 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [1 1 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([1 0 0 0 0 0 0 0 1 1 0 1 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [1 1 0 0 0 0 0 0 1 1 0 1 0 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      1 1 0 1 0 0 0 0 1 1 1 1 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               1 0 0 0 0 0 0 0 1 1 1 1 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [1 1 0 0 0 0 0 0 1 1 0 1 0 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      1 1 0 1 0 0 0 0 1 1 1 1 0 \r\n      1 0 0 0 0 0 0 0 1 1 1 1 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               1 0 0 0 0 0 0 0 1 1 1 1 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [1 1 0 0 0 0 0 0 0 0 0 1 0 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 0 0 0 0 0 1 0 1 1 0 \r\n      1 0 0 0 0 0 0 0 1 1 0 1 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\n                           \r\nassert(isequal(isFlush(hm),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":69,"test_suite_updated_at":"2012-02-21T19:24:06.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-17T21:55:47.000Z","updated_at":"2026-04-02T20:50:40.000Z","published_at":"2012-02-21T19:24:06.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA flush is 5 cards of the same suit (row). If there are more than five cards in a suit to choose from, the highest five count. The Ace (first column) is the highest. The columns represent A, 2, 3, ... K.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 1 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a flush, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 1 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a flush\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1 0 0 0 0 0 0 0 0 1 1 1 1 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 1 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 1 0 1 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be FALSE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand matrix, but it only shows the cards used to make the flush. If more than one flush can be made, return the higher ranking one (the one with the highest top card. Ace being the highest- ties broken by the second, third, fourth, and then fifth card). If different suits are possible for the same flush, return the one higher up in the matrix. If the flush happens to also be a straight flush, it still meets the defintion and should be returned. The highest flush should be returned, even if a straight flush can also be made.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":334,"title":"Poker Series 03: isFullHouse","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nA full house is three cards of one rank (column) and two cards of a different rank.  The Ace (first column) is the highest rank.  The columns represent A, 2, 3, ... K.  When there is a choice between two possible three of a kind, choose the higher.  Once a three of a kind is choosen, choose the highest possible pair.\r\n\r\nThis hand matrix:\r\n\r\n  0 1 0 0 0 0 0 1 0 0 0 0 0 \r\n  0 0 0 0 0 0 0 0 0 0 0 0 0\r\n  0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 1 0 0 0 0 0 1 0 0 0 0 0\r\n\r\nrepresents a full house, so the return value from the function is TRUE.\r\n\r\nThis hand matrix does not:\r\n\r\n  0 1 1 0 1 0 0 0 0 0 0 0 0 \r\n  0 0 0 1 0 0 0 0 0 0 0 0 0\r\n  0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 1 0 0 0 0 0 0 0 0 0\r\n\r\nso the return value should be FALSE.\r\n\r\nThis hand matrix does represent a full house\r\n\r\n  1 0 1 0 0 0 0 0 0 0 1 0 1 \r\n  0 0 1 0 0 1 0 0 0 0 0 0 0\r\n  0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 1 0 1 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n\r\nWould be FALSE for this function.\r\n\r\nA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand Matrix, but it only shows the cards used to make the full house.  If more than one full house can be made, return the higher ranking one (the one with the highest ranking three of a kind.  Ace being the highest.  Ties are broken with the highest ranking pair).  If different suits are possible for the same full house, return the ones higher up in the matrix.","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior.  Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use.  This program will be expandable to use 5 card hands through 52 card hands!  Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series.  To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed.  This is being done as an exercise in coding.  The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eA full house is three cards of one rank (column) and two cards of a different rank.  The Ace (first column) is the highest rank.  The columns represent A, 2, 3, ... K.  When there is a choice between two possible three of a kind, choose the higher.  Once a three of a kind is choosen, choose the highest possible pair.\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 0 0 0 1 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n0 1 0 0 0 0 0 1 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003erepresents a full house, so the return value from the function is TRUE.\u003c/p\u003e\u003cp\u003eThis hand matrix does not:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 0 0 0 0 0 0 0 0 \r\n0 0 0 1 0 0 0 0 0 0 0 0 0\r\n0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n0 0 0 1 0 0 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eso the return value should be FALSE.\u003c/p\u003e\u003cp\u003eThis hand matrix does represent a full house\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1 0 1 0 0 0 0 0 0 0 1 0 1 \r\n0 0 1 0 0 1 0 0 0 0 0 0 0\r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 1 0 0 0 0 0 0 0\r\n\u003c/pre\u003e\u003cp\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 1 0 1 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n\u003c/pre\u003e\u003cp\u003eWould be FALSE for this function.\u003c/p\u003e\u003cp\u003eA second output argument should come from this function.  It is a usedCards Matrix.  It is of the same form as the hand Matrix, but it only shows the cards used to make the full house.  If more than one full house can be made, return the higher ranking one (the one with the highest ranking three of a kind.  Ace being the highest.  Ties are broken with the highest ranking pair).  If different suits are possible for the same full house, return the ones higher up in the matrix.\u003c/p\u003e","function_template":"function out = isFullHouse(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 1 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isFullHouse(hm),y_correct))\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 1 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isFullHouse(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 1 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 1 0 0 0 0 0 0 1 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 1 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 1 0 0 0 0 0 0 1 0 \r\n                               0 0 0 0 1 0 0 0 0 0 0 1 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 1 0 0 0 0 0 0 0 0])\r\nassert(isequal(isFullHouse(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 1 0 0 0 1 1 0 1 1 \r\n      1 1 0 0 1 0 0 0 0 0 0 0 0\r\n      1 0 0 1 1 0 0 0 0 0 0 0 0 \r\n      1 1 0 0 1 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 1 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 1 0 0 0 0 0 0 0 0\r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isFullHouse(hm),y_correct))\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 1 0 0 0 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isFullHouse(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      1 1 0 0 0 1 0 0 0 0 0 1 0\r\n      0 0 0 1 0 1 0 0 1 0 0 0 0 \r\n      1 0 0 0 0 1 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 1 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 1 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 1 0 0 0 0 0 0 0])\r\nassert(isequal(isFullHouse(hm),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":71,"test_suite_updated_at":"2012-02-17T21:20:39.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-17T21:20:39.000Z","updated_at":"2026-04-02T20:43:08.000Z","published_at":"2012-02-17T21:54:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA full house is three cards of one rank (column) and two cards of a different rank. The Ace (first column) is the highest rank. The columns represent A, 2, 3, ... K. When there is a choice between two possible three of a kind, choose the higher. Once a three of a kind is choosen, choose the highest possible pair.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 0 0 0 1 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 1 0 0 0 0 0 0 0 0 0 0 0 \\n0 1 0 0 0 0 0 1 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a full house, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 0 0 0 0 0 0 0 0 \\n0 0 0 1 0 0 0 0 0 0 0 0 0\\n0 0 0 1 0 0 0 0 0 0 0 0 0 \\n0 0 0 1 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a full house\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1 0 1 0 0 0 0 0 0 0 1 0 1 \\n0 0 1 0 0 1 0 0 0 0 0 0 0\\n0 0 1 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 1 0 1 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be FALSE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the full house. If more than one full house can be made, return the higher ranking one (the one with the highest ranking three of a kind. Ace being the highest. Ties are broken with the highest ranking pair). If different suits are possible for the same full house, return the ones higher up in the matrix.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":333,"title":"Poker Series 02: isQuads","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\n\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\n\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n\r\n--------\r\n\r\nFour of a kind is four cards of the same rank (column) and the highest other card as a 'kicker'.  The columns represent A, 2, 3, ... K in the input.  Aces are high.\r\n\r\nThis hand matrix:\r\n\r\n  0 1 0 0 0 1 0 0 0 0 0 0 0 \r\n  0 1 0 0 0 0 0 0 0 0 0 0 0\r\n  0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 1 0 0 0 0 0 0 0 0 0 0 0\r\nrepresents quads, so the return value from the function is TRUE.\r\n\r\nThis hand matrix does not:\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 1 0 0 0 0 0 0 0 0 0\r\n  0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n  0 0 0 1 0 0 0 0 0 0 0 0 0\r\nso the return value should be FALSE.\r\n\r\nThis hand matrix does represent quads\r\n\r\n  1 0 0 0 0 0 0 0 0 0 0 0 1 \r\n  1 0 0 0 0 0 0 0 0 0 0 0 0\r\n  1 0 1 0 0 0 0 0 0 1 0 0 0 \r\n  1 0 0 0 0 1 0 0 0 0 0 0 0\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\r\n  0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n  0 0 0 0 1 0 1 0 0 0 0 0 0\r\n  0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n  0 0 1 0 0 0 0 0 0 0 0 0 0 \r\nWould be FALSE for this function.\r\n\r\nA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Quads plus kicker. If more than one Quads can be made, return the higher ranking one (Ace being the highest). If different suits are possible for the kicker, return the one higher up in the matrix.\r\n\r\n","description_html":"\u003cp\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/p\u003e\u003cp\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/p\u003e\u003cp\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/p\u003e\u003cp\u003e--------\u003c/p\u003e\u003cp\u003eFour of a kind is four cards of the same rank (column) and the highest other card as a 'kicker'.  The columns represent A, 2, 3, ... K in the input.  Aces are high.\u003c/p\u003e\u003cp\u003eThis hand matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 0 0 0 1 0 0 0 0 0 0 0 \r\n0 1 0 0 0 0 0 0 0 0 0 0 0\r\n0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n0 1 0 0 0 0 0 0 0 0 0 0 0\r\nrepresents quads, so the return value from the function is TRUE.\r\n\u003c/pre\u003e\u003cp\u003eThis hand matrix does not:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 1 0 0 0 0 0 0 0 0 0\r\n0 0 0 1 0 0 0 0 0 0 0 0 0 \r\n0 0 0 1 0 0 0 0 0 0 0 0 0\r\nso the return value should be FALSE.\r\n\u003c/pre\u003e\u003cp\u003eThis hand matrix does represent quads\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1 0 0 0 0 0 0 0 0 0 0 0 1 \r\n1 0 0 0 0 0 0 0 0 0 0 0 0\r\n1 0 1 0 0 0 0 0 0 1 0 0 0 \r\n1 0 0 0 0 1 0 0 0 0 0 0 0\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 1 0 1 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\nWould be FALSE for this function.\r\n\u003c/pre\u003e\u003cp\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Quads plus kicker. If more than one Quads can be made, return the higher ranking one (Ace being the highest). If different suits are possible for the kicker, return the one higher up in the matrix.\u003c/p\u003e","function_template":"function out = isQuads(hm)\r\n  out.flag = false;\r\n  out.usedCards = false(4,13)\r\nend","test_suite":"%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 1 0 0 0 0 0 0 0 0 0 0 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isQuads(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 0 0 0 1 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0\r\n      0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 0 1 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0])\r\nassert(isequal(isQuads(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0\r\n      0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isQuads(hm),y_correct))\r\n\r\n%%\r\nhm = [1 0 0 0 0 0 0 0 1 0 0 0 1 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0\r\n      0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([1 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0])\r\nassert(isequal(isQuads(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n      0 1 0 0 0 0 0 0 1 0 0 0 0\r\n      0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n      0 1 0 0 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 1 0 0 0 0 0 0 1 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0])\r\nassert(isequal(isQuads(hm),y_correct))\r\n\r\n%%\r\nhm = [1 0 0 1 0 0 0 0 1 0 0 0 1 \r\n      0 0 0 1 0 0 0 0 1 0 0 0 0\r\n      0 0 0 1 0 0 0 0 1 0 0 0 0 \r\n      0 0 0 1 0 0 0 0 1 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([1 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 1 0 0 0 0])\r\nassert(isequal(isQuads(hm),y_correct))\r\n\r\n%%\r\n hm = [1 0 0 0 0 0 0 1 0 0 0 0 0\r\n       1 0 0 0 0 0 0 1 0 0 0 0 1\r\n       1 0 0 0 0 0 0 1 0 0 0 0 0\r\n       1 0 0 0 0 0 0 1 0 0 0 0 0];\r\n \r\ny_correct.flag = true; \r\ny_correct.usedCards = logical(...\r\n      [1 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       1 0 0 0 0 0 0 0 0 0 0 0 1 \r\n       1 0 0 0 0 0 0 0 0 0 0 0 0 \r\n       1 0 0 0 0 0 0 0 0 0 0 0 0]);\r\n   \r\nassert(isequal(isQuads(hm),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":90,"test_suite_updated_at":"2016-12-13T18:48:26.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-17T18:21:26.000Z","updated_at":"2026-04-02T20:32:11.000Z","published_at":"2012-02-17T21:02:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFour of a kind is four cards of the same rank (column) and the highest other card as a 'kicker'. The columns represent A, 2, 3, ... K in the input. Aces are high.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 0 0 0 1 0 0 0 0 0 0 0 \\n0 1 0 0 0 0 0 0 0 0 0 0 0\\n0 1 0 0 0 0 0 0 0 0 0 0 0 \\n0 1 0 0 0 0 0 0 0 0 0 0 0\\nrepresents quads, so the return value from the function is TRUE.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 1 0 0 0 0 0 0 0 0 0\\n0 0 0 1 0 0 0 0 0 0 0 0 0 \\n0 0 0 1 0 0 0 0 0 0 0 0 0\\nso the return value should be FALSE.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent quads\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1 0 0 0 0 0 0 0 0 0 0 0 1 \\n1 0 0 0 0 0 0 0 0 0 0 0 0\\n1 0 1 0 0 0 0 0 0 1 0 0 0 \\n1 0 0 0 0 1 0 0 0 0 0 0 0\\nRemember, hand matrices can contain any number of 1's from 0 to 52.\\n\\n0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 1 0 1 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0 \\nWould be FALSE for this function.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Quads plus kicker. If more than one Quads can be made, return the higher ranking one (Ace being the highest). If different suits are possible for the kicker, return the one higher up in the matrix.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":329,"title":"Poker Series 01: isStraightFlush","description":"The Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\r\nA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\r\nFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\r\n--------\r\nA straight flush is 5 cards of the same suit (row) and five continuous ranks (columns). The Ace (first column) can also make a straight flush when combined with the last four columns. The columns represent A, 2, 3, ... K.\r\nThis hand matrix:\r\n0 1 1 1 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\nrepresents a straight flush, so the return value from the function is TRUE.\r\nThis hand matrix does not:\r\n0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 1 0 0 0 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\nso the return value should be FALSE.\r\nThis hand matrix does represent a straight flush\r\n1 0 0 0 0 0 0 0 0 1 1 1 1 \r\n0 0 0 0 0 0 0 0 0 0 0 0 0\r\n0 0 1 0 0 0 0 0 0 0 0 0 0 \r\n0 0 0 0 0 1 0 0 0 0 0 0 0\r\nRemember, hand matrices can contain any number of 1's from 0 to 52.\r\n0 1 1 0 1 1 0 0 0 0 0 0 0 \r\n0 0 0 0 1 0 1 0 0 0 0 0 0\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n0 0 1 0 0 0 0 0 0 0 0 0 0\r\nWould be FALSE for this function.\r\nA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Straight Flush. If more than one straight flush can be made, return the higher ranking one (the one with the highest top card. Ace being the highest). If different suits are possible for the same straight flush, return the one higher up in the matrix.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 940.933px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 470.467px; transform-origin: 407px 470.467px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373px 8px; transform-origin: 373px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373px 8px; transform-origin: 373px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 20px 8px; transform-origin: 20px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e--------\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 369.5px 8px; transform-origin: 369.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA straight flush is 5 cards of the same suit (row) and five continuous ranks (columns). The Ace (first column) can also make a straight flush when combined with the last four columns. The columns represent A, 2, 3, ... K.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 54px 8px; transform-origin: 54px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis hand matrix:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 1 1 1 1 1 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 230.5px 8px; transform-origin: 230.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003erepresents a straight flush, so the return value from the function is TRUE.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 83.5px 8px; transform-origin: 83.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis hand matrix does not:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 1 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 118px 8px; transform-origin: 118px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eso the return value should be FALSE.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 150.5px 8px; transform-origin: 150.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis hand matrix does represent a straight flush\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e1 0 0 0 0 0 0 0 0 1 1 1 1 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 1 0 0 0 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 1 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 221.5px 8px; transform-origin: 221.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 1 1 0 1 1 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 1 0 1 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 104px 8.5px; tab-size: 4; transform-origin: 104px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 0 0 0 0 0 0 0 0 0 0 0 \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e0 0 1 0 0 0 0 0 0 0 0 0 0\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 106px 8px; transform-origin: 106px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWould be FALSE for this function.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 370px 8px; transform-origin: 370px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Straight Flush. If more than one straight flush can be made, return the higher ranking one (the one with the highest top card. Ace being the highest). If different suits are possible for the same straight flush, return the one higher up in the matrix.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function out = isStraightFlush(hm)\r\n  out.flag      = false;\r\n  out.usedCards = false(4,13);\r\nend","test_suite":"%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 1 1 1 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0\r\n      0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 1 1 1 1 1 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isStraightFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0\r\n      0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = false;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isStraightFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      1 0 0 0 0 0 0 0 0 1 1 1 1\r\n      0 1 0 0 0 0 0 0 0 0 0 0 0 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 1 1 1 1\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isStraightFlush(hm),y_correct))\r\n\r\n%%\r\nhm = [0 0 0 0 0 0 0 0 1 1 0 1 1 \r\n      1 0 0 0 0 0 0 0 0 1 1 1 1\r\n      1 1 0 0 0 0 0 0 0 1 1 1 1 \r\n      0 0 0 0 0 0 0 0 0 0 0 0 0];\r\n\r\ny_correct.flag = true;\r\ny_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               1 0 0 0 0 0 0 0 0 1 1 1 1\r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0 \r\n                               0 0 0 0 0 0 0 0 0 0 0 0 0])\r\nassert(isequal(isStraightFlush(hm),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":8,"created_by":240,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":124,"test_suite_updated_at":"2021-09-27T06:47:34.000Z","rescore_all_solutions":false,"group_id":15,"created_at":"2012-02-16T20:30:55.000Z","updated_at":"2026-04-02T20:19:31.000Z","published_at":"2012-02-17T18:24:19.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Poker Series consists of many short, well defined functions that when combined will lead to complex behavior. Our goal is to create a function that will take two hand matrices (defined below) and return the winning hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA hand matrix is 4x13 binary matrix showing the cards that are available for a poker player to use. This program will be expandable to use 5 card hands through 52 card hands! Suits of the cards are all equally ranked, so they only matter for determination of flushes (and straight flushes).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor each challenge, you should feel free to reuse your solutions from prior challenges in the series. To break this problem into smaller pieces, I am likely making architectural choices that are sub-optimal for speed. This is being done as an exercise in coding. The larger goal of this project can likely be done in a much faster, but more obscure way.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e--------\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA straight flush is 5 cards of the same suit (row) and five continuous ranks (columns). The Ace (first column) can also make a straight flush when combined with the last four columns. The columns represent A, 2, 3, ... K.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 1 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003erepresents a straight flush, so the return value from the function is TRUE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does not:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 1 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso the return value should be FALSE.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis hand matrix does represent a straight flush\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1 0 0 0 0 0 0 0 0 1 1 1 1 \\n0 0 0 0 0 0 0 0 0 0 0 0 0\\n0 0 1 0 0 0 0 0 0 0 0 0 0 \\n0 0 0 0 0 1 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemember, hand matrices can contain any number of 1's from 0 to 52.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[0 1 1 0 1 1 0 0 0 0 0 0 0 \\n0 0 0 0 1 0 1 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0 0 0 0 \\n0 0 1 0 0 0 0 0 0 0 0 0 0]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWould be FALSE for this function.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA second output argument should come from this function. It is a usedCards Matrix. It is of the same form as the hand Matrix, but it only shows the cards used to make the Straight Flush. If more than one straight flush can be made, return the higher ranking one (the one with the highest top card. Ace being the highest). If different suits are possible for the same straight flush, return the one higher up in the matrix.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"no_progress_badge":{"id":53,"name":"Unknown","symbol":"unknown","description":"Partially completed groups","description_html":null,"image_location":"/images/responsive/supporting/matlabcentral/cody/badges/problem_groups_unknown_2.png","bonus":null,"players_count":0,"active":false,"created_by":null,"updated_by":null,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"created_at":"2018-01-10T23:20:29.000Z","updated_at":"2018-01-10T23:20:29.000Z","community_badge_id":null,"award_multiples":false}}