You are here

CODE: Haskell non-transitive dice constructor

Plain text icon nontrans.hs.txt18.67 KB
Plain text icon Misc.hs.txt16.07 KB

I'm slowly learning Haskell. Today's project was something that arguably should be way faster for a fluent Haskell programmer than for a C programmer. It wasn't for me, since I'm still learning the language.

The recent BoingBoing posting on "nontransitive dice" is something I'd seen before and found interesting…

I wrote a small Haskell program, attached to this post, that searches for sets of non-transitive dice. Its input and output both need tinkering with, but shy of that it's pretty good. You'll need GHC version 6 to compile and run the code.

Here's a set of 3 dice it just produced.

For any two adjacent dice (wrapping around), the higher one will defeat the lower one on 20 of 36 rolls.

These dice are worse than the BoingBoing ones because the edge is small (20/36) and there are ties. It's better, though, because these are dice with just the numbers 1..6 on them, and just a set of 3 and somewhat randomized. YMMV.

Remember, no taking folks' hard-earned money away from them. Other than that, have fun. Fob



Remember, casinos have only a slight edge, for good reason. People will catch on to a 2/3 edge soon enough that you get less money out of them, but a 20/36 edge lets them win more often, which might well let you get more money before they decide to stop playing.