How ’bout that 2048 game? Pretty addictive, huh? Almost as addictive as embedded systems are, at least if you’re [Andrew]. Armed (pun intended) with a Nucleo F4 and a Gameduino 2 shield, he decided to have a go at making an embedded version of the popular tile pusher web game.
If you’re unfamiliar with the Nucleo boards from STMicroelectronics, check out our post on the Nucleo family from a couple of months ago. The Gameduino 2 shield ships with a 4.3″ touchscreen driven by an FT800 GPU EVE. [Andrew] wrote his own driver for it and his blog post goes into great detail about its programming model and the SPI read, write, and command functions he wrote. Full code is available from [Andrew]’s repo.
He started by generating a blank screen based on clues found in the Gameduino 2 source. Pretty soon he had rendered a rectangle and then a full 2048 board. A minor difference between [Andrew]’s creation and the original is that his always creates new tiles as ‘2’ while the web game cranks out the occasional ‘4’.
We were unable to embed [Andrew]’s gameplay videos, but you’ll find two on his blog.
6 thoughts on “2048: Embedded Edition”
Well… I know what I must now make…
My algorithm for winning this stupid game:
up, right, up, right, up, right, …, up, right
When nothing happens for up or right: left or down, then *immediately* back to up/right.
Refining the algo:
* Switch to right, up, right, up etc. to balance out sides when they grow
* After doing a left or down, do multiple up,up or right, right to merge high values in the corner.
* To fix diagonal rows of the same value: use left, down, UP (important here), right. Trick is to not push the new block spawned to the right every time.
This algorithm works surprisingly well I must say, a little to well to be true actually..
I came up with the exact algorithm while sitting in a sushi restaurant :)
Thanks for the link Hack a Day!!!
And then there’s a port to the original gameboy: https://github.com/Sanqui/2048-gb
That is a fantastic idea. Gameboy, GBA, etc should all have this game.
Great game, cool hack.
Now where can I find a square touchscreen for this…. I’m thinking one button to turn it on and off and a picture frame style border. Actually, why not make it a picture frame/slideshow thing that doubles as a handheld 2048?
I had plans to make one with a vacuum fluorescent display. They come in a square form-factor. I was thinking to put four tactile switches above, below, to the left and to the right of the screen.
I imagine the FT800 can support square displays just fine, if you can find one :)
Please be kind and respectful to help make the comments section excellent. (Comment Policy)