# Pumpktris: When Carving Pumpkins and Tetris Collide

If you’re a creative, writing down all your crazy ideas and revisiting them later can spark some truly interesting and wonderful inventions. One of those awesome ideas Nathan from Hahabird had was to take a pumpkin and turn it into the classic video game Tetris. The combination of carving pumpkins and Tetris collide and turn into the fully realized Pumpktris! Fully playable, embedded in a pumpkin, and with the stem serving as a controller.

His original idea was to make forms to shape pumpkins as they grew into Tetris pieces, then stack them together on Halloween and have a stellar front porch Halloween decoration. When he stumbled upon his old idea notepad, he realized that it was too late in the game to plant pumpkins and wait for them to grow. So he did the next best thing and decided to rig LED lights inside a pumpkin, carve out a grid, and code software to make a playable Tetris game on an actual pumpkin.

Here’s a little something about how he coded the game for all the geeks out there:

There are seven Tetrominos—yes, that’s what they’re called—in the game. Each has four points, as implied by the “tetra” prefix. A three-dimensional array stores the location of every pixel of every shape, in each of four possible rotations. Storing each rotation is a lot easier (for my brain at least) than calculating it on the fly. As an example, here’s the T shape:

/* T */ {

/* angle 0 */ { {0,1}, {1,1}, {2,1}, {1,2} },

/* angle 90 */ { {1,0}, {1,1}, {2,1}, {1,2} },

/* angle 180 */ { {1,0}, {0,1}, {1,1}, {2,1} },

/* angle 270 */ { {1,0}, {0,1}, {1,1}, {1,2} }

}

He said that everything worked out great except for some occasional glitches, mostly chalked up to the fact that intermittent shorts are bound to happen when that many electronics are buried inside of a pumpkin. See his original post to check out the full step-by-step process on how he made Pumpktris.

via: Haha Bird & Notcot