August 25th, 2004

color cycle (slow)

The Permutor

Okay, ubergeek time here.

A well-known fact is that I play on TopCoder. I do so with great regularity, and enjoy the challenge- I'm not that great at the game, but it's a lot of fun.

Something I've missed more than once: something where I can give it a pile of objects (a Set or an array) and it will consecutively spit out every possible ordering of those objects. A standardized Object that makes brute force much, much simpler to implement- and makes it possible to do so iteratively, without need for dangerous levels of recursion.

I have built my masterpiece. I have built the Permutor. It is the generalized solution to the "find all permutations" problem. It runs, as it must, in factorial time, but that's because the raw size of the output increases in a factorial manner; it's as streamlined as I could make it.

Now that I've solved it, I never have to solve the problem again! The Permutor has been written- and I will never need to do it again.

Anybody curious about the source code is welcome to it- but TopCoder players, please remember that all library code must be your own. Write your own version- probably a better one. Want it for something else? Y'all are welcome to it.

It's sad. I feel like this is the biggest thing I've accomplished all month, and I am also fully aware that for most purposes, the Permutor is almost completely useless, as any brute force that runs in n! time is rarely the solution called for.
  • Current Mood
    geeky geeky
confused, buh?


Something I picked up several years ago: A really, really nice Mah-Jongg set. I don't know why, it was one of those impulse buys and I think I was only 10 or 11 at the flea market. Whatever, I'm glad now that I made the purchase; it's a nice set. The trick now is to find three other people curious about this Chinese form of Rummy.

Then the trick is finding a legible set of directions for the game. The ones included with the set are not particularly helpful in this regard. The game is, apparently, authentically Chinese, as the rules only bear a vague resemblance to English. Help with any leads on actually interpretable directions are welcomed.

But some quotes: Collapse )
  • Current Mood
    confused confused