{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-16T00:12:35.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-16T00:00:00.000Z","image_id":null,"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":null,"description_html":null,"published_at":null},"problems":[{"id":44502,"title":"Anyone for tennis?  Your chances of winning a (standard) game","description":"Imagine you are playing tennis, and for _each point_ played your chance of winning is |x| % (input as a |\u003chttps://au.mathworks.com/help/matlab/ref/uint8.html uint8\u003e|).  Given the \u003chttp://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx ITF's scoring system for a \"standard game\" of tennis\u003e (excerpted below), please determine your likelihood of winning a game (output as a |\u003chttps://au.mathworks.com/help/matlab/ref/single.html single\u003e|).  \r\n\r\nNote that as |x| is taken to be the same for every point in this problem, it does not matter whether you are serving or not.  \r\n\r\nEXAMPLE\r\n\r\n x = uint8(40)\r\n chance = single(0.2642707692307693)\r\n\r\n-----\r\n\r\n*\"* A standard game is scored as follows with the server’s score being called first:\r\n\r\n* No point - “Love”\r\n* First point - “15”\r\n* Second point - “30”\r\n* Third point - “40”\r\n* Fourth point - “Game”\r\n\r\nexcept that if each player/team has won three points, the score is “Deuce”.\r\nAfter “Deuce”, the score is “Advantage” for the player/team who wins the next point. If that same player/team also wins the next point, that player/team wins the “Game”; if the opposing player/team wins the next point, the score is again “Deuce”. A player/team needs to win two consecutive points immediately after “Deuce” to win the “Game”. *\"*\r\n\r\n-----\r\n\r\nSee also \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44503 Problem 44503. Anyone for tennis? Your chances of winning a tie-break game\u003e.","description_html":"\u003cp\u003eImagine you are playing tennis, and for \u003ci\u003eeach point\u003c/i\u003e played your chance of winning is \u003ctt\u003ex\u003c/tt\u003e % (input as a \u003ctt\u003e\u003ca href = \"https://au.mathworks.com/help/matlab/ref/uint8.html\"\u003euint8\u003c/a\u003e\u003c/tt\u003e).  Given the \u003ca href = \"http://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx\"\u003eITF's scoring system for a \"standard game\" of tennis\u003c/a\u003e (excerpted below), please determine your likelihood of winning a game (output as a \u003ctt\u003e\u003ca href = \"https://au.mathworks.com/help/matlab/ref/single.html\"\u003esingle\u003c/a\u003e\u003c/tt\u003e).\u003c/p\u003e\u003cp\u003eNote that as \u003ctt\u003ex\u003c/tt\u003e is taken to be the same for every point in this problem, it does not matter whether you are serving or not.\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cpre\u003e x = uint8(40)\r\n chance = single(0.2642707692307693)\u003c/pre\u003e\u003cp\u003e-----\u003c/p\u003e\u003cp\u003e\u003cb\u003e\"\u003c/b\u003e A standard game is scored as follows with the server’s score being called first:\u003c/p\u003e\u003cul\u003e\u003cli\u003eNo point - “Love”\u003c/li\u003e\u003cli\u003eFirst point - “15”\u003c/li\u003e\u003cli\u003eSecond point - “30”\u003c/li\u003e\u003cli\u003eThird point - “40”\u003c/li\u003e\u003cli\u003eFourth point - “Game”\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eexcept that if each player/team has won three points, the score is “Deuce”.\r\nAfter “Deuce”, the score is “Advantage” for the player/team who wins the next point. If that same player/team also wins the next point, that player/team wins the “Game”; if the opposing player/team wins the next point, the score is again “Deuce”. A player/team needs to win two consecutive points immediately after “Deuce” to win the “Game”. \u003cb\u003e\"\u003c/b\u003e\u003c/p\u003e\u003cp\u003e-----\u003c/p\u003e\u003cp\u003eSee also \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44503\"\u003eProblem 44503. Anyone for tennis? Your chances of winning a tie-break game\u003c/a\u003e.\u003c/p\u003e","function_template":"function chance = standardGame(x)\r\n\r\n    % Your comments \r\n    \r\nend","test_suite":"%% Please do not try to hack the Test Suite.  \r\n% The Test Suite will be updated if inappropriate submissions are received.  \r\n% This includes hard-coded (pre-calculated, externally calculated, manually calculated) 'solutions'.\r\nfiletext = fileread('standardGame.m');\r\nvec = [923273, 144780, 713710, 217788, 507812, 992110, 170355, 264270, 376851, 475014];\r\nmsg = 'Please do not hard-code your ''solution''.';\r\nassert( all( arrayfun(@(z) isempty(strfind(filetext, num2str(z))), vec) ) , msg )\r\n\r\n%% Test self-consistency:  \r\n% There are only two players, so the chances for each should add up to one.  \r\nassert( abs(standardGame(100)+standardGame(0) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(90)+standardGame(10) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(80)+standardGame(20) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(70)+standardGame(30) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(60)+standardGame(40) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(50)+standardGame(50) - 1)  \u003c 20 * eps(single(1)) )\r\n\r\n%%\r\nx = uint8(50);\r\ny_correct = 0.50;\r\nassert( isequal(standardGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(0);\r\ny_correct = 0;\r\nassert( isequal(standardGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(100);\r\ny_correct = 1;\r\nassert( isequal(standardGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(5);\r\ny_correct = 0.0000923273480663;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(10);\r\ny_correct = 0.0014478048780488;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(15);\r\ny_correct = 0.0071371057046980;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(20);\r\ny_correct = 0.0217788235294118;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(25);\r\ny_correct = 0.0507812500000000;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(30);\r\ny_correct = 0.0992110344827586;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(35);\r\ny_correct = 0.1703553555045871;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(40);\r\ny_correct = 0.2642707692307693;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(45);\r\ny_correct = 0.3768514975247527;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(49);\r\ny_correct = 0.4750149924031987;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%% Test adherence to instructions\r\nfor i = 1:5\r\n    x = uint8( randi(100) );\r\n    assert( isequal(class(standardGame(x)), 'single') )\r\nend;\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2018-01-18T10:56:38.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-01-18T00:25:34.000Z","updated_at":"2019-07-02T13:23:52.000Z","published_at":"2018-01-18T01:51:18.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\u003eImagine you are playing tennis, and for\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eeach point\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e played your chance of winning is\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e % (input as a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/uint8.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003euint8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e). Given the\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://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eITF's scoring system for a \\\"standard game\\\" of tennis\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (excerpted below), please determine your likelihood of winning a game (output as a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/single.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle\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\u003eNote that as\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is taken to be the same for every point in this problem, it does not matter whether you are serving or not.\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\u003eEXAMPLE\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[ x = uint8(40)\\n chance = single(0.2642707692307693)]]\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-----\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A standard game is scored as follows with the server’s score being called first:\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\u003eNo point - “Love”\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\u003eFirst point - “15”\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\u003eSecond point - “30”\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\u003eThird point - “40”\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\u003eFourth point - “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\u003eexcept that if each player/team has won three points, the score is “Deuce”. After “Deuce”, the score is “Advantage” for the player/team who wins the next point. If that same player/team also wins the next point, that player/team wins the “Game”; if the opposing player/team wins the next point, the score is again “Deuce”. A player/team needs to win two consecutive points immediately after “Deuce” to win the “Game”.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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\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\u003eSee also\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/44503\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44503. Anyone for tennis? Your chances of winning a tie-break game\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\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":44503,"title":"Anyone for tennis?  Your chances of winning a tie-break game","description":"Imagine you are playing tennis and the score has reached 'six games all' in a Tie-break Set, so therefore the next game shall be a 'tie-break game', which is now to be played to decide the outcome of this set.  For _each point_ played in the tie-break game your chance of winning is |x| % (input as a |\u003chttps://au.mathworks.com/help/matlab/ref/uint8.html uint8\u003e|).  Given the \u003chttp://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx ITF's scoring system for a \"tie-break game\" of tennis\u003e (excerpted below), please determine your likelihood of winning the tie-break game (output as a |\u003chttps://au.mathworks.com/help/matlab/ref/single.html single\u003e|).  \r\n\r\nNote that as |x| is taken to be the same for every point in this problem, it does not matter whether you are serving or not.  \r\n\r\nEXAMPLE\r\n\r\n x = uint8(40)\r\n chance = single(0.2125443387076924)\r\n\r\n-----\r\n\r\n*\"* During a tie-break game, points are scored “Zero”, “1”, “2”, “3”, etc. The first player/team to win seven points wins the “Game” and “Set”, provided there is a margin of two points over the opponent(s). If necessary, the tie-break game shall continue until this margin is achieved. *\"*\r\n\r\n-----\r\n\r\nSee also \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44502 Problem 44502. Anyone for tennis? Your chances of winning a (standard) game\u003e.","description_html":"\u003cp\u003eImagine you are playing tennis and the score has reached 'six games all' in a Tie-break Set, so therefore the next game shall be a 'tie-break game', which is now to be played to decide the outcome of this set.  For \u003ci\u003eeach point\u003c/i\u003e played in the tie-break game your chance of winning is \u003ctt\u003ex\u003c/tt\u003e % (input as a \u003ctt\u003e\u003ca href = \"https://au.mathworks.com/help/matlab/ref/uint8.html\"\u003euint8\u003c/a\u003e\u003c/tt\u003e).  Given the \u003ca href = \"http://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx\"\u003eITF's scoring system for a \"tie-break game\" of tennis\u003c/a\u003e (excerpted below), please determine your likelihood of winning the tie-break game (output as a \u003ctt\u003e\u003ca href = \"https://au.mathworks.com/help/matlab/ref/single.html\"\u003esingle\u003c/a\u003e\u003c/tt\u003e).\u003c/p\u003e\u003cp\u003eNote that as \u003ctt\u003ex\u003c/tt\u003e is taken to be the same for every point in this problem, it does not matter whether you are serving or not.\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cpre\u003e x = uint8(40)\r\n chance = single(0.2125443387076924)\u003c/pre\u003e\u003cp\u003e-----\u003c/p\u003e\u003cp\u003e\u003cb\u003e\"\u003c/b\u003e During a tie-break game, points are scored “Zero”, “1”, “2”, “3”, etc. The first player/team to win seven points wins the “Game” and “Set”, provided there is a margin of two points over the opponent(s). If necessary, the tie-break game shall continue until this margin is achieved. \u003cb\u003e\"\u003c/b\u003e\u003c/p\u003e\u003cp\u003e-----\u003c/p\u003e\u003cp\u003eSee also \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44502\"\u003eProblem 44502. Anyone for tennis? Your chances of winning a (standard) game\u003c/a\u003e.\u003c/p\u003e","function_template":"function chance = tiebreakGame(x)\r\n\r\n    % Your comments \r\n    \r\nend","test_suite":"%% Please do not try to hack the Test Suite.  \r\n% The Test Suite will be updated if inappropriate submissions are received.  \r\n% This includes hard-coded (pre-calculated, externally calculated, manually calculated) 'solutions'.\r\n\r\n% EDIT (2019-06-24).  Anti-hacking provision\r\n% Ensure builtin function will be called.  (Probably only the second of these will work.)  \r\n! del fileread.m\r\n! rm -v fileread.m\r\n% Disallow certain words  \r\nRE = regexp(fileread('tiebreakGame.m'), '\\w+', 'match');\r\ntabooWords = {'ans', 'assert', 'freepass'};\r\ntestResult = cellfun( @(z) ismember(z, tabooWords), RE );\r\nmsg = ['Please do not do that in your code!' char([10 13]) ...\r\n    'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ...\r\n    'Banned word.' char([10 13])];\r\nassert(~any(  cellfun( @(z) ismember(z, tabooWords), RE )  ), msg)\r\n% END EDIT (2019-06-24)\r\n\r\nfiletext = fileread('tiebreakGame.m');\r\nvec = [5242178 5616877 7920095 4815022 1826772 5089792,5089793 1134259 2125443 3458492 4684486];\r\nmsg = 'Please do not hard-code your ''solution''.';\r\nassert( all( arrayfun(@(z) isempty(strfind(filetext, num2str(z))), vec) ) , msg )\r\n\r\n%% Test self-consistency:  \r\n% There are only two players, so the chances for each should add up to one.  \r\nassert( abs(tiebreakGame(100)+tiebreakGame(0) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(90)+tiebreakGame(10) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(80)+tiebreakGame(20) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(70)+tiebreakGame(30) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(60)+tiebreakGame(40) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(50)+tiebreakGame(50) - 1)  \u003c 20 * eps(single(1)) )\r\n\r\n%%\r\nx = uint8(50);\r\ny_correct = 0.50;\r\nassert( isequal(tiebreakGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(0);\r\ny_correct = 0;\r\nassert( isequal(tiebreakGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(100);\r\ny_correct = 1;\r\nassert( isequal(tiebreakGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(5);\r\ny_correct = 0.0000005242178465;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(10);\r\ny_correct = 0.0000561687707317;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(15);\r\ny_correct = 0.0007920095157735;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(20);\r\ny_correct = 0.0048150226823529;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(25);\r\ny_correct = 0.0182677268981934;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(30);\r\ny_correct = 0.0508979303379310;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(35);\r\ny_correct = 0.1134259300865006;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(40);\r\ny_correct = 0.2125443387076924;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(45);\r\ny_correct = 0.3458492328206313;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(49);\r\ny_correct = 0.4684486239083455;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%% Test adherence to instructions\r\nfor i = 1:5\r\n    x = uint8( randi(100) );\r\n    assert( isequal(class(tiebreakGame(x)), 'single') )\r\nend;\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2019-07-02T13:20:57.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-01-18T10:19:54.000Z","updated_at":"2019-07-02T13:20:57.000Z","published_at":"2018-01-18T10:57:34.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\u003eImagine you are playing tennis and the score has reached 'six games all' in a Tie-break Set, so therefore the next game shall be a 'tie-break game', which is now to be played to decide the outcome of this set. For\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eeach point\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e played in the tie-break game your chance of winning is\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e % (input as a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/uint8.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003euint8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e). Given the\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://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eITF's scoring system for a \\\"tie-break game\\\" of tennis\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (excerpted below), please determine your likelihood of winning the tie-break game (output as a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/single.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle\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\u003eNote that as\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is taken to be the same for every point in this problem, it does not matter whether you are serving or not.\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\u003eEXAMPLE\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[ x = uint8(40)\\n chance = single(0.2125443387076924)]]\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-----\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e During a tie-break game, points are scored “Zero”, “1”, “2”, “3”, etc. The first player/team to win seven points wins the “Game” and “Set”, provided there is a margin of two points over the opponent(s). If necessary, the tie-break game shall continue until this margin is achieved.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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\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\u003eSee also\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/44502\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44502. Anyone for tennis? Your chances of winning a (standard) game\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\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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":44502,"title":"Anyone for tennis?  Your chances of winning a (standard) game","description":"Imagine you are playing tennis, and for _each point_ played your chance of winning is |x| % (input as a |\u003chttps://au.mathworks.com/help/matlab/ref/uint8.html uint8\u003e|).  Given the \u003chttp://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx ITF's scoring system for a \"standard game\" of tennis\u003e (excerpted below), please determine your likelihood of winning a game (output as a |\u003chttps://au.mathworks.com/help/matlab/ref/single.html single\u003e|).  \r\n\r\nNote that as |x| is taken to be the same for every point in this problem, it does not matter whether you are serving or not.  \r\n\r\nEXAMPLE\r\n\r\n x = uint8(40)\r\n chance = single(0.2642707692307693)\r\n\r\n-----\r\n\r\n*\"* A standard game is scored as follows with the server’s score being called first:\r\n\r\n* No point - “Love”\r\n* First point - “15”\r\n* Second point - “30”\r\n* Third point - “40”\r\n* Fourth point - “Game”\r\n\r\nexcept that if each player/team has won three points, the score is “Deuce”.\r\nAfter “Deuce”, the score is “Advantage” for the player/team who wins the next point. If that same player/team also wins the next point, that player/team wins the “Game”; if the opposing player/team wins the next point, the score is again “Deuce”. A player/team needs to win two consecutive points immediately after “Deuce” to win the “Game”. *\"*\r\n\r\n-----\r\n\r\nSee also \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44503 Problem 44503. Anyone for tennis? Your chances of winning a tie-break game\u003e.","description_html":"\u003cp\u003eImagine you are playing tennis, and for \u003ci\u003eeach point\u003c/i\u003e played your chance of winning is \u003ctt\u003ex\u003c/tt\u003e % (input as a \u003ctt\u003e\u003ca href = \"https://au.mathworks.com/help/matlab/ref/uint8.html\"\u003euint8\u003c/a\u003e\u003c/tt\u003e).  Given the \u003ca href = \"http://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx\"\u003eITF's scoring system for a \"standard game\" of tennis\u003c/a\u003e (excerpted below), please determine your likelihood of winning a game (output as a \u003ctt\u003e\u003ca href = \"https://au.mathworks.com/help/matlab/ref/single.html\"\u003esingle\u003c/a\u003e\u003c/tt\u003e).\u003c/p\u003e\u003cp\u003eNote that as \u003ctt\u003ex\u003c/tt\u003e is taken to be the same for every point in this problem, it does not matter whether you are serving or not.\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cpre\u003e x = uint8(40)\r\n chance = single(0.2642707692307693)\u003c/pre\u003e\u003cp\u003e-----\u003c/p\u003e\u003cp\u003e\u003cb\u003e\"\u003c/b\u003e A standard game is scored as follows with the server’s score being called first:\u003c/p\u003e\u003cul\u003e\u003cli\u003eNo point - “Love”\u003c/li\u003e\u003cli\u003eFirst point - “15”\u003c/li\u003e\u003cli\u003eSecond point - “30”\u003c/li\u003e\u003cli\u003eThird point - “40”\u003c/li\u003e\u003cli\u003eFourth point - “Game”\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eexcept that if each player/team has won three points, the score is “Deuce”.\r\nAfter “Deuce”, the score is “Advantage” for the player/team who wins the next point. If that same player/team also wins the next point, that player/team wins the “Game”; if the opposing player/team wins the next point, the score is again “Deuce”. A player/team needs to win two consecutive points immediately after “Deuce” to win the “Game”. \u003cb\u003e\"\u003c/b\u003e\u003c/p\u003e\u003cp\u003e-----\u003c/p\u003e\u003cp\u003eSee also \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44503\"\u003eProblem 44503. Anyone for tennis? Your chances of winning a tie-break game\u003c/a\u003e.\u003c/p\u003e","function_template":"function chance = standardGame(x)\r\n\r\n    % Your comments \r\n    \r\nend","test_suite":"%% Please do not try to hack the Test Suite.  \r\n% The Test Suite will be updated if inappropriate submissions are received.  \r\n% This includes hard-coded (pre-calculated, externally calculated, manually calculated) 'solutions'.\r\nfiletext = fileread('standardGame.m');\r\nvec = [923273, 144780, 713710, 217788, 507812, 992110, 170355, 264270, 376851, 475014];\r\nmsg = 'Please do not hard-code your ''solution''.';\r\nassert( all( arrayfun(@(z) isempty(strfind(filetext, num2str(z))), vec) ) , msg )\r\n\r\n%% Test self-consistency:  \r\n% There are only two players, so the chances for each should add up to one.  \r\nassert( abs(standardGame(100)+standardGame(0) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(90)+standardGame(10) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(80)+standardGame(20) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(70)+standardGame(30) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(60)+standardGame(40) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(standardGame(50)+standardGame(50) - 1)  \u003c 20 * eps(single(1)) )\r\n\r\n%%\r\nx = uint8(50);\r\ny_correct = 0.50;\r\nassert( isequal(standardGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(0);\r\ny_correct = 0;\r\nassert( isequal(standardGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(100);\r\ny_correct = 1;\r\nassert( isequal(standardGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(5);\r\ny_correct = 0.0000923273480663;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(10);\r\ny_correct = 0.0014478048780488;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(15);\r\ny_correct = 0.0071371057046980;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(20);\r\ny_correct = 0.0217788235294118;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(25);\r\ny_correct = 0.0507812500000000;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(30);\r\ny_correct = 0.0992110344827586;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(35);\r\ny_correct = 0.1703553555045871;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(40);\r\ny_correct = 0.2642707692307693;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(45);\r\ny_correct = 0.3768514975247527;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(49);\r\ny_correct = 0.4750149924031987;\r\nassert( abs( standardGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%% Test adherence to instructions\r\nfor i = 1:5\r\n    x = uint8( randi(100) );\r\n    assert( isequal(class(standardGame(x)), 'single') )\r\nend;\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2018-01-18T10:56:38.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-01-18T00:25:34.000Z","updated_at":"2019-07-02T13:23:52.000Z","published_at":"2018-01-18T01:51:18.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\u003eImagine you are playing tennis, and for\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eeach point\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e played your chance of winning is\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e % (input as a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/uint8.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003euint8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e). Given the\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://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eITF's scoring system for a \\\"standard game\\\" of tennis\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (excerpted below), please determine your likelihood of winning a game (output as a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/single.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle\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\u003eNote that as\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is taken to be the same for every point in this problem, it does not matter whether you are serving or not.\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\u003eEXAMPLE\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[ x = uint8(40)\\n chance = single(0.2642707692307693)]]\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-----\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A standard game is scored as follows with the server’s score being called first:\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\u003eNo point - “Love”\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\u003eFirst point - “15”\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\u003eSecond point - “30”\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\u003eThird point - “40”\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\u003eFourth point - “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\u003eexcept that if each player/team has won three points, the score is “Deuce”. After “Deuce”, the score is “Advantage” for the player/team who wins the next point. If that same player/team also wins the next point, that player/team wins the “Game”; if the opposing player/team wins the next point, the score is again “Deuce”. A player/team needs to win two consecutive points immediately after “Deuce” to win the “Game”.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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\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\u003eSee also\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/44503\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44503. Anyone for tennis? Your chances of winning a tie-break game\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\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":44503,"title":"Anyone for tennis?  Your chances of winning a tie-break game","description":"Imagine you are playing tennis and the score has reached 'six games all' in a Tie-break Set, so therefore the next game shall be a 'tie-break game', which is now to be played to decide the outcome of this set.  For _each point_ played in the tie-break game your chance of winning is |x| % (input as a |\u003chttps://au.mathworks.com/help/matlab/ref/uint8.html uint8\u003e|).  Given the \u003chttp://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx ITF's scoring system for a \"tie-break game\" of tennis\u003e (excerpted below), please determine your likelihood of winning the tie-break game (output as a |\u003chttps://au.mathworks.com/help/matlab/ref/single.html single\u003e|).  \r\n\r\nNote that as |x| is taken to be the same for every point in this problem, it does not matter whether you are serving or not.  \r\n\r\nEXAMPLE\r\n\r\n x = uint8(40)\r\n chance = single(0.2125443387076924)\r\n\r\n-----\r\n\r\n*\"* During a tie-break game, points are scored “Zero”, “1”, “2”, “3”, etc. The first player/team to win seven points wins the “Game” and “Set”, provided there is a margin of two points over the opponent(s). If necessary, the tie-break game shall continue until this margin is achieved. *\"*\r\n\r\n-----\r\n\r\nSee also \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44502 Problem 44502. Anyone for tennis? Your chances of winning a (standard) game\u003e.","description_html":"\u003cp\u003eImagine you are playing tennis and the score has reached 'six games all' in a Tie-break Set, so therefore the next game shall be a 'tie-break game', which is now to be played to decide the outcome of this set.  For \u003ci\u003eeach point\u003c/i\u003e played in the tie-break game your chance of winning is \u003ctt\u003ex\u003c/tt\u003e % (input as a \u003ctt\u003e\u003ca href = \"https://au.mathworks.com/help/matlab/ref/uint8.html\"\u003euint8\u003c/a\u003e\u003c/tt\u003e).  Given the \u003ca href = \"http://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx\"\u003eITF's scoring system for a \"tie-break game\" of tennis\u003c/a\u003e (excerpted below), please determine your likelihood of winning the tie-break game (output as a \u003ctt\u003e\u003ca href = \"https://au.mathworks.com/help/matlab/ref/single.html\"\u003esingle\u003c/a\u003e\u003c/tt\u003e).\u003c/p\u003e\u003cp\u003eNote that as \u003ctt\u003ex\u003c/tt\u003e is taken to be the same for every point in this problem, it does not matter whether you are serving or not.\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cpre\u003e x = uint8(40)\r\n chance = single(0.2125443387076924)\u003c/pre\u003e\u003cp\u003e-----\u003c/p\u003e\u003cp\u003e\u003cb\u003e\"\u003c/b\u003e During a tie-break game, points are scored “Zero”, “1”, “2”, “3”, etc. The first player/team to win seven points wins the “Game” and “Set”, provided there is a margin of two points over the opponent(s). If necessary, the tie-break game shall continue until this margin is achieved. \u003cb\u003e\"\u003c/b\u003e\u003c/p\u003e\u003cp\u003e-----\u003c/p\u003e\u003cp\u003eSee also \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44502\"\u003eProblem 44502. Anyone for tennis? Your chances of winning a (standard) game\u003c/a\u003e.\u003c/p\u003e","function_template":"function chance = tiebreakGame(x)\r\n\r\n    % Your comments \r\n    \r\nend","test_suite":"%% Please do not try to hack the Test Suite.  \r\n% The Test Suite will be updated if inappropriate submissions are received.  \r\n% This includes hard-coded (pre-calculated, externally calculated, manually calculated) 'solutions'.\r\n\r\n% EDIT (2019-06-24).  Anti-hacking provision\r\n% Ensure builtin function will be called.  (Probably only the second of these will work.)  \r\n! del fileread.m\r\n! rm -v fileread.m\r\n% Disallow certain words  \r\nRE = regexp(fileread('tiebreakGame.m'), '\\w+', 'match');\r\ntabooWords = {'ans', 'assert', 'freepass'};\r\ntestResult = cellfun( @(z) ismember(z, tabooWords), RE );\r\nmsg = ['Please do not do that in your code!' char([10 13]) ...\r\n    'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ...\r\n    'Banned word.' char([10 13])];\r\nassert(~any(  cellfun( @(z) ismember(z, tabooWords), RE )  ), msg)\r\n% END EDIT (2019-06-24)\r\n\r\nfiletext = fileread('tiebreakGame.m');\r\nvec = [5242178 5616877 7920095 4815022 1826772 5089792,5089793 1134259 2125443 3458492 4684486];\r\nmsg = 'Please do not hard-code your ''solution''.';\r\nassert( all( arrayfun(@(z) isempty(strfind(filetext, num2str(z))), vec) ) , msg )\r\n\r\n%% Test self-consistency:  \r\n% There are only two players, so the chances for each should add up to one.  \r\nassert( abs(tiebreakGame(100)+tiebreakGame(0) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(90)+tiebreakGame(10) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(80)+tiebreakGame(20) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(70)+tiebreakGame(30) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(60)+tiebreakGame(40) - 1)  \u003c 20 * eps(single(1)) )\r\nassert( abs(tiebreakGame(50)+tiebreakGame(50) - 1)  \u003c 20 * eps(single(1)) )\r\n\r\n%%\r\nx = uint8(50);\r\ny_correct = 0.50;\r\nassert( isequal(tiebreakGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(0);\r\ny_correct = 0;\r\nassert( isequal(tiebreakGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(100);\r\ny_correct = 1;\r\nassert( isequal(tiebreakGame(x), y_correct) )\r\n\r\n%%\r\nx = uint8(5);\r\ny_correct = 0.0000005242178465;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(10);\r\ny_correct = 0.0000561687707317;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(15);\r\ny_correct = 0.0007920095157735;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(20);\r\ny_correct = 0.0048150226823529;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(25);\r\ny_correct = 0.0182677268981934;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(30);\r\ny_correct = 0.0508979303379310;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(35);\r\ny_correct = 0.1134259300865006;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(40);\r\ny_correct = 0.2125443387076924;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(45);\r\ny_correct = 0.3458492328206313;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%%\r\nx = uint8(49);\r\ny_correct = 0.4684486239083455;\r\nassert( abs( tiebreakGame(x) - y_correct ) \u003c 10 * eps(single(y_correct)) )\r\n\r\n%% Test adherence to instructions\r\nfor i = 1:5\r\n    x = uint8( randi(100) );\r\n    assert( isequal(class(tiebreakGame(x)), 'single') )\r\nend;\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2019-07-02T13:20:57.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-01-18T10:19:54.000Z","updated_at":"2019-07-02T13:20:57.000Z","published_at":"2018-01-18T10:57:34.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\u003eImagine you are playing tennis and the score has reached 'six games all' in a Tie-break Set, so therefore the next game shall be a 'tie-break game', which is now to be played to decide the outcome of this set. For\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eeach point\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e played in the tie-break game your chance of winning is\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e % (input as a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/uint8.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003euint8\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e). Given the\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://www.itftennis.com/procircuit/about-pro-circuit/rules-regulations.aspx\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eITF's scoring system for a \\\"tie-break game\\\" of tennis\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (excerpted below), please determine your likelihood of winning the tie-break game (output as a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://au.mathworks.com/help/matlab/ref/single.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle\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\u003eNote that as\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is taken to be the same for every point in this problem, it does not matter whether you are serving or not.\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\u003eEXAMPLE\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[ x = uint8(40)\\n chance = single(0.2125443387076924)]]\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-----\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e During a tie-break game, points are scored “Zero”, “1”, “2”, “3”, etc. The first player/team to win seven points wins the “Game” and “Set”, provided there is a margin of two points over the opponent(s). If necessary, the tie-break game shall continue until this margin is achieved.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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\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\u003eSee also\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/44502\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44502. Anyone for tennis? Your chances of winning a (standard) game\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\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\"}]}"}],"term":"tag:\"sport\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"sport\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"sport\"","","\"","sport","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f572f4423b0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f572f442310\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f572f441a50\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f572f442630\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f572f442590\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f572f4424f0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f572f442450\u003e":"tag:\"sport\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f572f442450\u003e":"tag:\"sport\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"sport\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"sport\"","","\"","sport","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f572f4423b0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f572f442310\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f572f441a50\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f572f442630\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f572f442590\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f572f4424f0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f572f442450\u003e":"tag:\"sport\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f572f442450\u003e":"tag:\"sport\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44502,"difficulty_rating":"hard"},{"id":44503,"difficulty_rating":"hard"}]}}