Luckless Dice Game


We all know the SparkFun community likes to shoot dice - we are a rough and tumble crowd, for sure. Of course, dice can be a bit frustrating since, for the most part, dice games are pure blind luck. Here is a nice Arduino project from Mike Cook that takes the luck out of playing dice.

Based off a game from Ian Stewart's book "The Cow Maze," this game is essentially a math puzzle where the user plays against the computer. It works like this: A number is displayed on the screen, which is called a "heap." You start the game by taking the die and placing it on the sensor with the number you want facing up. This number is subtracted from the heap and then the computer takes a turn. The goal is to hit exactly zero without going over. The two catches are that you can't use the same number twice in a row and you can't use the number that is facing down. So if the computer "throws" a four, you can't use four or three.

As far as construction of the game goes, it consists of an ATmega with Arduino bootloader, five hall effect sensors, an LCD screen, and a few other bits and pieces. The die itself has been outfitted with magnets in place of the typical dots and the hall effect sensors are arranged in such a way that they can detect which way the die is facing. The gameplay itself is controlled by some very clever programming and a "move matrix." Everything is contained in a nice custom enclosure that turns the game on when it is opened and off when it is closed. Mike does a very nice job of documenting this project at his website - check it out! Very nice work!


Comments 16 comments

  • Thanks for the kind comments.
    OSGill, I am English and in the English language, according to the Oxford English Dictionary, dice is an acceptable singular along with the word die.
    However, it might be different in your native tong. :-)
    So to scharkalvin yes it is it’s own singular and many people make the mistake of thinking many people make a mistake.

  • nice but wouldn’t that be an unfair die because of the extra magnets in the sides with the larger number? It may not happen much but you may end up rolling more ones because the six side will sometimes stay down more than usual.

    • As I understand the rules, you do not roll the die. You select the number, any number from 1 to 6, with the exception of the previous number or seven minus the previous number (the bottom number on the die). Hence, “luckless” part of the game.

      • Right-o. Klone is correct that if this was a game where you rolled the die, it wouldn’t be balanced correctly and would skew the odds. But since you simply place the die, no problem!

  • Nice box! Well done.
    The only way to improve on this is to accept that the replay value of the game itself is pretty low, and angle it as a party fun thing by giving it a bigger display and a huge list of funny sayings to print out when it interacts with you.
    Could you move the dice for me? I don’t have hands!
    Do you smell that? It’s BACON! The only thing that smells like that is BACON!
    That girl over there is totally checking you out!
    I am fluent in over 6 million forms of dice games, you will not beat the alliance!

  • “Everything is contained in a nice customer enclosure that turns the game on when it is opened and off when it is closed."
    I love customer enclosures! Sparkfun.com is my favorite example! ;-)

  • Very nice project and awesome writeup! I like the theory section where he figures out which sensors are redundant.
    I had a similar (unimplemented) idea using hall effect sensors and magnet-enhanced blocks to build a physical sudoku game.

  • Nicely done. I have several SMT reed relays for projects that would be similar by using magnets in various positions for user feedback.
    Reminds me of my daughter’s leapfrog alphabet magnet toy on our fridge. Each letter is it’s own magnet and they have a unique set of ribs along the bottom edge. If you pick up a letter off the fridge and place it into the leapfrog doohickey, the ribs mate with microswitches and it knows the letter and does a little song…..
    How about a wireless die with two of those cheap directional switches for V2?

  • Nice, I like this, it needs a speed setting though, I’d imagine after 5 fails you’d be bored of the box slowly and calmly telling you to put down a 2 for it :P well done though.

  • That’s pretty sweet :-) Reminds me a bit of Blackjack, where you have to reach 21, but not go over.
    You could probably use the image sensor from an optical mouse to see the die face, instead of using a die stuffed with magnets.

  • “Pick up the dice"
    are there two?

  • Classy, like this a lot.


This Week

Heartbleed

This Month

Happy Arduino Day!

SXSW Create 2014