I am always amazed at the creativity of the MATLAB community, so I am posting all the files needed so you can implement your own solution. I have included my solution also, but I recommend not looking until you have tried your own.
Since this is a more involved problem, posting to the comments does not seem as reasonable. Please e-mail me (firstname.lastname@example.org) your completed code (one file, has everything it needs to run, your contact info in the comments) and I will put together a video covering the best of ideas. If I use your code or ideas in the video, I will send you a MATLAB t-shirt.
MINOR SPOILER ALERT
What I have discovered is that this program either finds a solution very quickly, or does not find one before I get bored (5 minutes, I should run it overnight….). I take a “greedy” approach (selecting the color that will cause the largest change), this is not always optimal. I am doing an exhaustive search, only looking one move ahead. This will find a solution if it is possible, but there might be a better way.
要发表评论，请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。