Whose zebra is it anyways?

The applet above (requiring a Java 1.4 compatible jvm for no reason other than a few asserts) will solve certain puzzles by brute force. These puzzles have the following form:

It doesn't matter what the number of people (<=8), categories or final question is of course, as long as it's on this basic form. This app will stupidly permutate (and I mean stupidly, it was written long ago for a one-time thing and doesn't even backtrack or distribute) through all possible arrangements and check each and every one against the rules. If they're all satisified, a solution has been found. If you don't specify any rules, all thousands of billions of solutions will be found, probably messing things up pretty badly (so don't).

In this example, you'd input the categories "Pet: Dog, cat, fish, turkey, zebra", "Color: Red, blue, green, yellow white", etc, and rules in the for "Nationality norwegian is with Pet dog", "Drink tea is next to Color red".

This is O((n!)^n), so don't expect answers for anything with more than five catogories within reasonable limits (took 40 mins for me). There are better ways of solving such things, but this one is by far the easiest to code.

Get the jar here (hint: -server for additional speed). It works fine as both applet and a standalone app. Source included, GPL.