Matt Tearle - MATLAB Cody - MATLAB Central

Matt Tearle

1109
Rank
18
Badges
2018
Score
1 – 50 of 158

Matt Tearle submitted a Comment to Problem 55985. Generate Tribonacci Sequence

Thanks, Marco. Added that.

on 23 Feb 2024

Matt Tearle submitted a Comment to Problem 56190. Split Even Number Into Two Primes

Thanks for that catch, Filip. I added the ordering to the problem description.

on 23 Feb 2024

Matt Tearle submitted a Comment to Problem 56538. Cricket - Report the Result (Part II: Test Matches)

"The test cases are all real matches, so they are correct", I said overconfidently, overlooking my ability to make stupid copy-paste errors! :) Thanks again, Rafael for helping find that bug in the tests. You're right that #11 is incorrect - I left off the "(f/o)" on England's second innings. Without it, the score doesn't make any sense because England had more runs, but are all out in what would be the 4th innings, which is impossible. I'll update the test but won't rescore the solutions, so your answers will stand as correct (I don't want to risk breaking your hard work for my mistake). Your interpretation of test #2 is correct. India batted once. Australia is behind on runs but their second innings is still in progress, so it's a draw. @Christian: you're right that if you assume the scores have been recorded correctly, you don't need to look for the follow-ons for the MATLAB to work correctly. If you're looking to figure out if an innings is completed, then the "d" after the "/w" is important - I'm guessing that's what you used it for. But you can also shortcut that. When I said declarations don't affect the result, I meant the way the result is reported ("n wickets" or "n runs") - in the table, "___" could mean 123 or 123/4d. Glad you enjoyed the problems, despite not understanding the subject matter! Maybe that was part of the challenge?

on 13 Nov 2022

Matt Tearle submitted a Comment to Problem 56538. Cricket - Report the Result (Part II: Test Matches)

Tip: you can ignore ties, so you can get the total scores for both teams and one will be higher than the other. That gives you a "provisional winner" and "loser". That's when the last paragraph (about a result vs a draw) kicks in: unless the "losing" team has completed both innings, it's a draw. That means you need to figure out a way to tell if that has happened. (Hint: the first innings must have been completed if there's a second one; the second innings would only be completed if all 10 wickets have been taken*). If it's not a draw, then the result will be one of the options in the table. [*] A declaration also completes the innings, but declaring your second innings while you're still losing would be suicide, so that will never occur. Hence, a (non-draw) result occurs only if the "losing" team is all out in their second innings. How to figure out if a team is all out is given in the second paragraph.

on 12 Nov 2022

Matt Tearle submitted a Comment to Problem 56538. Cricket - Report the Result (Part II: Test Matches)

Thanks, Rafael for all your feedback. It's helpful to get a "cricket outsider's" insights. The last two problems of the set were intended to be challenging, and it's blowing my mind that the first two people to finish them did so with no cricket knowledge! Well done. I'm trying to walk a line between not giving enough information and making it impossible for those who don't have the cricket background, and giving too much information and thus giving away the solution. In this problem, use the table as your guide to determining results (other than a draw). Notice that declarations don't appear in the table - they don't have any effect on the result. I mentioned them in the problem description because I didn't want people to make assumptions about the formatting (like: the scores will always end with a numeric digit) and base their string/regexp/pattern approach on those incorrect assumptions. Follow-ons change the order of the innings, so do have some effect - again, follow the table - but there's no requirement that either declarations or follow-ons occur. See the first code example for one that has nothing but simple scores. It's entirely possible that something in my description is incorrect or misleading. The test cases are all real matches, so they are correct. If you think a test case doesn't match the description, let me know and I can either correct the description or add some explanation. (The conventions here *are* weird. That's cricket for you.)

on 12 Nov 2022

Matt Tearle submitted a Comment to Problem 56543. Cricket - Is It LBW?

Thanks, Rafael, for adding the extra info. I didn't want to bloat the instructions with too much detail - to be honest, I didn't expect so many non-cricket-familiar people to try these problems! Tip #3 (FPNIC): an image search for "lbw review" should bring up plenty of examples of how it looks in reality, with the graphics they overlay on the television coverage. That's roughly what I was channeling when I made the diagrams in the problem statement. (I don't want to include actual images in case I violate any copyright by accident.)

on 11 Nov 2022

Matt Tearle submitted a Comment to Problem 56533. Cricket - You Miss, I Hit (Rank Bowlers by Proportion of Bowled and LBW Wickets)

@Raphael: Thank you for catching that - I was tweaking the example and didn't update the image correctly. I have now. To clarify: Raphael is correct that "caught and bowled" does *not* count to the "bowled" category. And yes, in the example, if Ned's second wicket was "bowled" or "lbw" instead of "caught and bowled", then he would have WWProp = 0.5 and should be included as the last row of the output table, having at least 2 wickets and a proportion of at least 0.5.

on 11 Nov 2022

Matt Tearle received Famous badge

on 10 Nov 2022

Matt Tearle submitted a Comment to Solution 9690613

@Lev: the line "combo=combo+1;" means that in some cases, the output can be > 1. All the other test cases just force-converted to logical so any nonzero numeric return will be T and 0 will be F. Test 20, however, actually checks against another logical, so the numerical return (>1) fails. The problem states that the function should return logical T/F, so there should probably be a test specifically for that.

on 8 Nov 2022

Matt Tearle submitted a Comment to Problem 56175. Dartboard Average II

@Dyuman Joshi: thanks, good catch. I've added that to the description.

on 25 Oct 2022

Matt Tearle submitted a Comment to Solution 9428338

@Jason Friedman: good suggestion. I've added some example code that should help.

on 24 Oct 2022

Matt Tearle submitted a Comment to Problem 55250. Find the minimum of the column-maximums of a matrix

@Neha Shaah: how so? If the input is a row vector, the column maximums will be the elements themselves. Hence the minimum will be the minimum of the input vector itself.

on 24 Oct 2022

Matt Tearle submitted a Comment to Solution 9206550

I don't understand the comments about exp(1). "e" (exp(1)) is listed as one of the constants in the problem statement. Its value is 2.7183... So an input of 2.5 should return e, as shown in the examples (being closer to 2.5 than sqrt(2) = 1.414...)

on 24 Oct 2022

Matt Tearle received Leader badge for Solution 9591728

on 24 Oct 2022

Matt Tearle received Puzzler badge

on 24 Oct 2022

1 – 50 of 158
Go to top of page