A D6 dice has 6 different patterns of dots on each of its 6 faces to represent the values 1 through 6. We have 10 NeoPixels on our Circuit Playground, so we've got enough lights. We'll turn 1 light on for a roll of 1, 2 lights for 2, etc. We just need to come up with which NeoPixels to use.

The NeoPixel layout could be anything, but the following attempts to match the D6 dice face patterns as much as possible.

 ROLL = 1 NeoPixels: 2 ROLL = 2 NeoPixels: 4, 9 ROLL = 3 NeoPixels: 0, 4, 7 ROLL = 4 NeoPixels: 1, 3, 6, 8 ROLL = 5 NeoPixels: 0, 2, 4, 5, 9 ROLL = 6 NeoPixels: 0, 2, 4, 5, 7, 9

# Storing the Face Patterns

Here's a simple approach for storing the above patterns of NeoPixels. The idea is to use a two dimensional (2D) array. The first dimension is simply the number of the roll, i.e. 1 through 6, so we'll need 6 entries. The second dimension of the array specifies the NeoPixels to light up for the dice roll. Since we are lighting up 1 NeoPixel per dice value, this will also need to have 6 entries.

So, we can do something like this:

```uint8_t dicePixels[6][6] = {  // Pixel pattern for dice roll
{ 2, 0, 0, 0, 0, 0 } ,      // Roll = 1
{ 4, 9, 0, 0, 0, 0 } ,      //        2
{ 0, 4, 7, 0, 0, 0 } ,      //        3
{ 1, 3, 6, 8, 0, 0 } ,      //        4
{ 0, 2, 4, 5, 9, 0 } ,      //        5
{ 0, 2, 4, 5, 7, 9 } ,      //        6
};```

You'll see this get used later in the final code.

This guide was first published on Dec 16, 2016. It was last updated on Dec 16, 2016.