A few days ago we announced our new website, www.pexforfun.com. We had a tremendous response, and tens of thousands of visitors asking Pex to solve puzzles. Thanks to everyone for trying it out!

Puzzle Sharing Made Easy

We have just added a big new Permalink This Puzzle button, which allows you create a unique URL for puzzles – it works for puzzles that are built into the website, as well as for puzzles that you write or edit yourself.

image

You can share your own puzzles with your friends, or post them on our MSDN Forums for Pex, to discuss it with other people. Try it out, make yourself familiar with the idea of creating your own puzzles – we are planning to have competitions soon.

New Puzzles

We have just added two new Puzzles:

  • HashSetTestAddContains shows how Pex, and Pex for fun, support Parameterized Unit Testing. You can think of a Parameterized Unit Test as a special kind of puzzle, which should never cause any bad behavior, in all code that gets called, for all possible input values. In this particular puzzle, you have to figure out what it means to add two values to a HashSet. The puzzle comes with its own implementation of a HashSet, but can you imagine that you would want to write this kind of “specification” before even writing any code. (And in fact, we left some bugs here in the implementation, so it’s not quite complete.) When you write the “specification”/”parameterized unit test”/“unit tests” before the actual implementation, then that is called Test-Driven Development. 
    image
  • Another tricky puzzle is CreditCardNumber. It shouldn’t come as a surprise to you that every credit card number has some kind of check digit in it. It’s well documented how this check digit works. Given some code that implements a validity checker for credit card numbers, can you figure out an example of what a (potentially) valid credit card number is? You probably want to use pen and paper for some side-calculations. Or just “Ask Pex!”

Have fun!

The Pex team