It's midnight (in the terminal)

by Matt Griffith

It's midnight (in the terminal)

Some years ago, I was introduced by some friends to a dice game called midnight. They had learned this game one night out at the NorthStar Cafe in San Francisco, and since then it's been part of our hang outs, especially nights together in Tahoe or Las Vegas.

The rules are simple, you require only 6 dice, and since any number of people can play, you can always get a game started. The fact that it also enables quick and easy gambling is the cherry on top.

I've recently started dusting off my Ruby skills, and a big part of that has been using the open source curriculum The Odin Project. Some of the projects in the Ruby track have you create programs that enable you to play games of tic-tac-toe or chess using the terminal. Great games, and probably interesting challenges, but I didn't want to create the millionth version of TTT or chess - much better to create something that I want to use and doesn't already exist.

Now on pat leave in Costa Rica, I found myself stuck in the house for a couple days with a sick wife and baby. Go time!

Results can be found on GitHub here

A big debate among our group is around the optimal strategy to employ when it comes to retaining dice. For example, on an opening roll that contains a 1, 4, and 6, is it optimal to retain all 3? Or just the 6? How does your rolling position affect your decision? What about the number of players? The current high score? The pot size, or ties, or or or?

Hopefully I can extend the program to do some strategy testing and write a future post with some results. In the meantime, enjoy rolling some digital bones.

 



Matt Griffith
Matt Griffith

Author