MATLAB Community

MATLAB, community & more

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Cody Turns One Million 2

Posted by Ned Gulley,

Suppose I give you an image like this little smiley face.

And now I ask you to stretch it vertically and horizontally by replicating the pixels. Stretch it sideways by a factor of 4 and down by a factor of 2 and you get this.

Notice we didn’t just do a “visual” stretch by adjusting the figure borders. We increased the number of pixels in each dimension. Every pixel in the first image becomes a 2-by-4 superpixel brick in the second image.

That’s the kind of array enlarging you’re being asked to do in Cody problem 1853 by Matthew Eicholtz. How would you solve this problem?

Here’s how Augusto Mazzei solved it just before midnight on 24 June 2017.

Augusto’s solution works well, but the reason it caught my eye has more to do with the highlighted number in the lower right corner. As it happens, Augusto had submitted the millionth Cody solution. If that’s not worth a MATLAB t-shirt, I don’t know what is. Augusto is a veteran Cody player, currently sitting at number 77 on the leader board. I sent him an email yesterday to ask him about his experience with MATLAB and Cody, and to congratulate him on his millionth solution.

I learned that Augusto is a student of aerospace engineering at the Forlì campus of the University of Bologna in Italy. He’s been using MATLAB since his first year there, and he loves programming and gaming. He has even connected these two passions by emulating famous arcade games in MATLAB (maybe we can see these on the File Exchange someday, Augusto?). He learned about Cody at school and decided to give it a try. He likes it as a way to improve his MATLAB skills, and by now he has solved 537 problems and earned 5 badges.

We’ll be sending him a MATLAB t-shirt to thank him for playing Cody. Congratulations and well done, Augusto!

Incidentally, problem 1853 shows off one of the things I really like about Cody. First you try something that works, and then you see that other people have shorter answers, and it makes you wonder how. Sometimes you find out that those answers are ugly string evaluation hacks, but sometimes you learn a cool new function that you never knew about before. In the case of problem 1853, you can eventually learn that the shortest entries are all using a function called kron. And that becomes an opportunity to add a nifty tool to your bag of MATLAB tricks.


Comments are closed.

2 CommentsOldest to Newest

mattheweicholtz replied on : 1 of 2

1 million solutions and counting! I’m excited that one of my problems played a small part in this Cody milestone. As a longtime Cody fan myself, I am happy to see that the millionth solution wasn’t an ugly string evaluation hack!

Thanks for the note Matthew! I’m glad we got to shine a spotlight on this problem, but your many problems and your many solutions have all made a big difference in growing Cody. Thanks!