Category: Tanglet (Page 3 of 3)

Adventures in Random Land

Posted on February 12, 2010, under Tanglet

Up until now I’ve used each platform’s random number generator in my games. Obviously they’re not good enough for statistical analysis, but in my experience they are okay for my simple programs. However, they’re not the same on Windows, Linux, and the Mac. Which means that a game seed on one platform won’t start the same game on another. And, if the platform makers change them at all, the saved games will break.

I decided to implement my own generator to solve those issues. It was a little tricky to wade through all of the discussions of random number generators, though, because it seems like everybody who talks about them is obsessed with the intricacies of the math. I know, it’s a complex field with complex solutions, but I don’t need something that is cryptographically secure!

In the end I decided to use a basic xorshift generator. Obviously, the algorithm isn’t strong enough for anything beyond my simple games, but I’m surprised at how easy it is to create random numbers. Repeatedly shift and XOR a seed number with a few “magic” numbers, and you’re all set.

Using a different generator will of course break saved games, so I’m thinking about wrapping up the platform generator in the same API (probably as a sub-class). I would simply need to add a field to the saved games specifying which generator to use, and if the game can’t find the field it will fall back to using the platform’s generator.

The first game to get the xorshift generator is Tanglet, because that is the one I am actively working on. Tanglet is also one of the easiest games to add it to, because it doesn’t save games across runs.

New Tanglet release

Posted on January 13, 2010, under Tanglet

8 comments

I have just released Tanglet 1.0.1, which has a few small bug fixes and a French translation provided by Mehdi Yousfi-Monod, including a word list and dice set. If you have any questions or comments about this release, please let me know. Otherwise, enjoy!

A new game

Posted on November 28, 2009, under Tanglet

A couple of months ago, my wife and I started playing the game Boggle. Neither of us could remember playing it before, but we were hooked right off of the start and couldn’t get enough of it.

Being me, I also couldn’t get the idea of writing a solver for the boards out of my head. I first wrote a stringlist matching solver, but that was incredibly slow. So I rewrote it to use a tree structure I designed specifically for walking through a list of words. I went looking online after I wrote my solver, and discovered that it is called a trie. And that they are a good way to solve Boggle. 🙂

I couldn’t stop tinkering with it, though, and soon found myself writing a computer version of Boggle. I have been working on a lot of things, so I didn’t focus on it solely and it ended up taking a couple of months to finish, although the amount of time I spent actually writing it was significantly less than that. Along with that I was sick recently, which delayed things a bit more.

I decided against having the computer version be multi-player for the reason that it is so easy to cheat. I had already written a simple GUI for solving boards, and it would take far less than 3 minutes to type the words into the solver and get the answers. I wouldn’t do that, but there would be no way to prevent other players from cheating.

After spending a little while thinking about it, I found what I think is a big improvement for a single player variant: you start with 30 seconds to find the words, but you get more time whenever you find a new word. I have found this to be a very addicting change.

I have released my computer variant of Boggle under the name of Tanglet. Enjoy!

Categories