A code duel
This site is showing off a tool from Microsoft research, called Pex. I downloaded it a few weeks ago with the intention of seeing what it does, but hadn’t gotten to it yet. I know it’s used for unit testing, which I’ve been working on a bit lately.
This site has “code duals”, where they give you a little snippet of code, and your task is to make your function return the same value as their “secret” function. After modifying the code, you click the “Ask Pex” button, and it uses Pex to run your function and compare your results to that of the secret.
Let me tell you, this is fun! The first few I saw were real easy, and I won the duals in no time. However, looking at their dual-of-the-week on Facebook, I’ve been stumped on one, and made it about 3/4 of the way through another.
And guess what? I’m learning things too. One of them has led me to look into code contracts, so I did a little reading on it. On the off chance I get some free time, I’ll probably continue to investigate this. (That is, I will as I built out more unit tests, but that’s a long process.)
If you’re looking for a little diversion, and Soduko just isn’t doing it for you, go take a look.