{"id":11469,"date":"2020-04-17T09:00:19","date_gmt":"2020-04-17T13:00:19","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=11469"},"modified":"2020-04-17T14:07:50","modified_gmt":"2020-04-17T18:07:50","slug":"a-nod-to-our-developers-and-a-game-of-minesweeper","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2020\/04\/17\/a-nod-to-our-developers-and-a-game-of-minesweeper\/","title":{"rendered":"A nod to our developers, and a game of Minesweeper"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>Before he Picks this Week's featured File Exchange submission, <a href=\"http:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911\">Brett<\/a> would like to give a nod of appreciation to the developers of the <a href=\"https:\/\/www.mathworks.com\/products\/image.html\">Image Processing Toolbox<\/a>. Back in September of 2018, I <a href=\"https:\/\/blogs.mathworks.com\/pick\/2018\/09\/07\/path-simplification-and-binary-image-reconstruction-made-easy\/?s_tid=srchtitle\">wrote here<\/a> about several tools that helped me solve a path-reduction problem that I was working on. In short, I had representations of several paths that had a lot of redundant vertices--they were collinear (or rather, collinear within a specified tolerance) with other consecutive vertices, and added no useful information to the graphics I needed to generate. In my effort to algorithmically eliminate them, I found my way to the <a href=\"https:\/\/www.mathworks.com\/help\/map\/ref\/reducem.html\"><tt>reducem<\/tt><\/a> implementation of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm\">\"Douglas-Peucker algorithm\"<\/a> (AKA, the \"Ramer-Douglas-Peucker algorithm\") in the <a href=\"https:\/\/www.mathworks.com\/products\/mapping.html\">Mapping Toolbox<\/a>.<\/p><p>There were several nice implementations of the algorithm on the File Exchange, and they gave me an easy <i>Toolbox-independent<\/i> path forward (ahem) for the problem at hand. I discussed the problem with the developers of the Image Processing Toolbox, and...lo and behold, about a year after that discussion (in R2019b), the team released <a href=\"https:\/\/www.mathworks.com\/help\/images\/ref\/reducepoly.html\">reducepoly<\/a> and, <tt>reduce<\/tt> as a <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/methods.html\">method<\/a> of <a href=\"https:\/\/www.mathworks.com\/help\/images\/roi-creation-overview.html\">images.roi objects<\/a>. It's not \"Toolbox-independent,\" per se, but it <i>is<\/i> more accessible to an image processing geek like me, and now readily available to users of one of our most popular tools. I'm very pleased to see that--nice work, Team!<\/p><p>And now, because we can all use a bit of levity in these trying times, I'm going to Pick a really nice <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/46145-minesweeper\">MATLAB version of Minesweeper<\/a>. <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3690384-brian-moore\">Brian Moore's<\/a> File Exchange contribution gave me and my son Cody (who is a bit of a Minesweeper addict, and whose game I captured below) a welcome relief from the tedium of in-home confinement.<\/p><!--\/introduction--><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/Minesweeper.png\" alt=\"\"> <\/p><p>There are other implementations of the game on the File Exchange--but Brian's was the first one I tried that installed directly with no problems. Thanks, Brian!<\/p><p>As always, I welcome your <a href=\"http:\/\/blogs.mathworks.com\/pick\/?p=11469#respond\">thoughts and comments<\/a>.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_f90ba9f5b33645c992d06012317cdbd6() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='f90ba9f5b33645c992d06012317cdbd6 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' f90ba9f5b33645c992d06012317cdbd6';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2020 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_f90ba9f5b33645c992d06012317cdbd6()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2020a<br><\/p><\/div><!--\r\nf90ba9f5b33645c992d06012317cdbd6 ##### SOURCE BEGIN #####\r\n%% A nod to our developers, and a game of Minesweeper\r\n%\r\n% Before he Picks this Week's featured File Exchange submission, <http:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911 Brett>\r\n% would like to give a nod of appreciation to the developers of the <https:\/\/www.mathworks.com\/products\/image.html Image Processing Toolbox>. \r\n% Back in September of 2018, I <https:\/\/blogs.mathworks.com\/pick\/2018\/09\/07\/path-simplification-and-binary-image-reconstruction-made-easy\/?s_tid=srchtitle wrote here> \r\n% about several tools that helped me solve a path-reduction problem that I was working on. In short, I had representations of several paths \r\n% that had a lot of redundant verticesREPLACE_WITH_DASH_DASHthey were collinear (or rather, collinear within a specified tolerance) \r\n% with other consecutive vertices, and added no useful information to the graphics \r\n% I needed to generate. In my effort to algorithmically eliminate them, I found my way to the \r\n% <https:\/\/www.mathworks.com\/help\/map\/ref\/reducem.html |reducem|> implementation of the \r\n% <https:\/\/en.wikipedia.org\/wiki\/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm \"Douglas-Peucker algorithm\"> \r\n% (AKA, the \"Ramer-Douglas-Peucker algorithm\") in the \r\n% <https:\/\/www.mathworks.com\/products\/mapping.html Mapping Toolbox>. \r\n%\r\n% There were several nice implementations of the algorithm on the File Exchange, and they gave me an easy _Toolbox-independent_ \r\n% path forward (ahem) for the problem at hand. I discussed the problem with\r\n% the developers of the Image Processing Toolbox, and...lo and behold,\r\n% about a year after that discussion (in R2019b), the team released \r\n% <https:\/\/www.mathworks.com\/help\/images\/ref\/reducepoly.html reducepoly> and, \r\n% |reduce| as a <https:\/\/www.mathworks.com\/help\/matlab\/ref\/methods.html method> of\r\n% <https:\/\/www.mathworks.com\/help\/images\/roi-creation-overview.html images.roi objects>. \r\n% It's not \"Toolbox-independent,\" per se, but it _is_ more accessible to an image processing\r\n% geek like me, and now readily available to users of one of our most popular tools. \r\n% I'm very pleased to see thatREPLACE_WITH_DASH_DASHnice work, Team!\r\n%\r\n% And now, because we can all use a bit of levity in these trying times, I'm going to Pick \r\n% a really nice <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/46145-minesweeper MATLAB version of Minesweeper>. \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3690384-brian-moore Brian Moore's> \r\n% File Exchange contribution gave me and my son Cody (who is a bit of a Minesweeper addict, and whose game I captured below) \r\n% a welcome relief from the tedium of in-home confinement. \r\n%%\r\n% \r\n% <<https:\/\/blogs.mathworks.com\/pick\/files\/Minesweeper.png>>\r\n% \r\n% There are other implementations of the game on the File ExchangeREPLACE_WITH_DASH_DASHbut\r\n% Brian's was the first one I tried that installed directly with no\r\n% problems. Thanks, Brian!\r\n% \r\n%%\r\n% As always, I welcome your\r\n% <http:\/\/blogs.mathworks.com\/pick\/?p=11469#respond thoughts and comments>.\r\n##### SOURCE END ##### f90ba9f5b33645c992d06012317cdbd6\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/Minesweeper.png\" onError=\"this.style.display ='none';\" \/><\/div><p>Before he Picks this Week's featured File Exchange submission, Brett would like to give a nod of appreciation to the developers of the Image Processing Toolbox. Back in September of 2018, I wrote... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2020\/04\/17\/a-nod-to-our-developers-and-a-game-of-minesweeper\/\">read more >><\/a><\/p>","protected":false},"author":34,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11469"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=11469"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11469\/revisions"}],"predecessor-version":[{"id":11479,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11469\/revisions\/11479"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=11469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=11469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=11469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}