Steve on Image Processing

Concepts, algorithms & MATLAB

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.

Saturday morning fun with Cody 4

Posted by Steve Eddins,

Early this morning my wife found me in the family room, typing away at my laptop. She glimpsed this diagram on my screen and asked if I was playing chess.

"I'm doing MATLAB, Cody, and chess at the same time," I responded. She gave me the "I have a weird husband" look and left to get her coffee.

You've probably heard of MATLAB and chess. If you haven't heard of Cody, it's an entertaining new ... umm ... game? ... on MATLAB Central. How to describe it? Well, there are bite-size (byte-size?) MATLAB programming puzzles, 248 of them so far. Then there are the players, almost 1,400 of them. Finally, there are the puzzle solutions, some 37,000 of them, created by the players.

I knew about the Cody project while it was under development, but I didn't pay too much attention to it until it went live a couple of weeks ago. I tried it out for the first time on Ground Hog's Day, and by the weekend I was just about addicted.

Here's a puzzle I solved just now. It was created by MathWorker and fellow blogger Doug Hull, who has been creating Cody puzzles based on Project Euler.

Suppose I click on the "Solve This Now!" button and try this solution:

Then I will see that my solution has failed the test suite that Doug created for this problem.

At this point I can think about what I did wrong and try again. (Readers, do you know what's wrong with my solution and how to correct it?)

Newcomers to Cody are eased into the game with simple puzzles like this:

I could not resist entering this tongue-in-cheek solution:

Speaking of tongue-in-cheek, what do you think about the cyclist's approach to marriage and to computing the volume of a common food item? The cyclist can be serious, too. There are already more than 150 puzzles created by the MATLAB community.

Speaking of the MATLAB community, since I started writing this blog post, ten solutions have already been entered for my new Eight Queens Solution Checker problem.

What's the matter with you people?? Don't you have anything better to do on Saturday morning? Oh ... wait ...

Anyway, I'm working on a set of Cody puzzles just for you, dear image processing blog readers. Stay tuned!

Get the MATLAB code

Published with MATLAB® 7.13


Comments are closed.

4 CommentsOldest to Newest

Tometheus replied on : 1 of 4
At this point I can think about what I did wrong and try again. (Readers, do you know what's wrong with my solution and how to correct it?)
*cough* "below" the input value. Note you failed on x= multiples of 5. (At least that's my first guess without being able to access the actual puzzle.)
Jotaf replied on : 3 of 4
This seems like a great initiative, congrats! It's great that you are making the process of learning better matlab fun. Personally, I started programming when I was a teenager, coding little games -- it seems there are multiple ways to achieve this :)
srivas replied on : 4 of 4
the problem with your project euler example is pretty simple. you included the the last number when it explicitly stated less than that number. it should have been: y=sum(unique([3:3:x-1,5:5:x-1]));