# General > IoT, IoE, and Maker Forum >  "2048" game in hardware

## wossname

Hi guys,

A while back I posted about my latest work-in-progress.   Thought I'd talk about it here just to get a little feedback.

I hope to make a very simple hand-held game based on the popular "2048" game (see here).

In essence it will be a small circuit board with a 4x4 grid of RGB lights and a set of 4 buttons.  Instead of numbers, I'll be using colours on a spectrum from red (low value) to green (high value).

My driving goal is a low price for the kit.  A secondary goal is a small size - perhaps something that might fit on a keyring.

Annoyingly, my laptop blew up a week or two ago so I'm unable to work on the circuit design at the moment, I'll upload some images of the design as soon as I'm back on my feet.  For the time being I'm just writing the firmware for the game on my raspi and will have to port it over to the microcontroller later on in the project.

I think I can get away with an Atmel ATTiny85 chip as the brains of the game.  I have previously used this chip to drive an array of 16 Neopixels to good effect.  hopefully if I recycle that LED driver code I can also cram in the game logic for 2048!

Sorry for the lack of detail at this time.  I hope to rectify that soon.

In the mean time, play this until you lose your mind...
http://gabrielecirulli.github.io/2048/

----------


## dclamp

I am excited to see how it will work. Send me one for free for... testing purposes...

Basically the 4 buttons will just be left, right, up, down?

Buy a new computer and get this show on the road!

----------


## wossname

Yep, 4 buttons for the directions.  Super simple really  :Smilie:   A friend has promised to build me a computer for cheap so I'm hoping to be up and running this week some time.  

The PCB design is at most 6 hours work total (go Diptrace!), after a few more hours for sourcing the components it'll be done.  I'll just send it out to the manufacturer without even prototyping it, it's a pretty basic design.  Maybe a month turnaround, which gives me a long time to get the code written 100%.

----------


## dclamp

Haven't heard of Diptrace... I have been using Fritzing to design my boards, although I haven't had one created yet. I am going to try that program out when I have a chance.

If the game works on a breadboard and you replicate it identically it should work fine without a prototype. Will probably save you a lot of money by not just ordering one PCB. Be sure to post your process as you go along. I wanna see how it comes along

----------


## passel

> ...
> In the mean time, play this until you lose your mind...
> http://gabrielecirulli.github.io/2048/


Stupid game... stayed up 'til 5 in the morning playing the #@#$#% thing.

----------


## dclamp

> Stupid game... stayed up 'til 5 in the morning playing the #@#$#% thing.


There are a few strategies to playing the game. The main strategy is to try to keep the largest number tile in one of the corners and not let it go anywhere else. Sometimes thats no possible. But you want to attempt to only move tiles toward that corner. Makes it easier to combined several tiles at once.

----------


## passel

> ...In essence it will be a small circuit board with a 4x4 grid of RGB lights and a set of 4 buttons.  Instead of numbers, I'll be using colours on a spectrum from red (low value) to green (high value).
> ...


I haven't played with RGB lights, but the need for 11 distinguishable colors (10 if you don't count the winning value) and the user being able to identify the "magnitude" seems like it might make it frustrating/tiring to play.
Have you written a quick prototype version you can run in windows to test what 11 colors you want to use and the playability of the game using those colors?

----------


## dclamp

Making a prototype in windows would be useless since you can display millions of colors with today's displays. I assume he has created an actual prototype or at least a breadboard model that shows the colors.

That actually brings up a good point... In 2048, its possible to get to 4096. Will it be impossible to add two green boxes together?

----------


## dclamp

Brings up another question. Are you going to make it possible to reprogram the chip to add your own firmware?

----------


## wossname

In answer to your questions...

Yes, the chip will be re-programmable in-situ.  I'll leave some pads on there for you to add a programming connector (or solder on some jump wires).  The original source will be available on my website.

As with the web-based game I'll allow you to continue after you've "won".  There will probably be a fancy animation when you hit 2048 for a few seconds and then it'll resume where you left it.

I think it will be possible to get up to 30 or more visually distinct colours by also varying the brightness of the cells as well as the colour and perhaps having the larger value cells flashing or pulsating somehow.  Depends if I've got any RAM left in the chip (it's pretty limited from the get-go).

----------


## dclamp

Great! Looking forward to this game. 

As far as RAM goes... I ran out of RAM a few times with my simple Thermometer / display device. STRINGs take up A LOT of space, not sure if you were aware. Stick to character arrays, they save space.

----------


## wossname

The boards are being made!
http://wardyprojects.blogspot.co.uk/...nufacture.html

----------


## dclamp

Looks good woss!

----------


## wossname

Boards arrived just now!!!
http://wardyprojects.blogspot.co.uk/...-osh-park.html

----------


## wossname

And......

http://wardyprojects.blogspot.co.uk/...-complete.html

----------


## dclamp

:Big Grin:  Such stoked. Much happy. Very excite. Wow.


But really, looks great

----------

