Blog Jul 21, 2021

The 2048 game implemented in 15 different programming languages

2048 has become so popular that many developers have implemented it in different programming languages to test their programming skills. In that vein, if you are a developer and are looking for some inspiration in your programming language, here it is our list. All versions listed below are open-source.

[Java] 2048_M-A-Star - This project provides an algorithm to solve the popular game 2048.

[Ruby] 2048-Ruby - 2048 is a fun tile matching mathematical game.

[Python] term2048 - A terminal version implemented in Python. You can install it through pip (pip install term2048).

[Golang] 2048.go - Yet another simple implementation of Game 2048 in Go.

[Rust] 2048-rust - A 2048 implementation that uses bit-shifting and a pre-computed move table this implementation is designed to provide low overhead when testing an algorithm on a large amount of games.

[C++] 2048.cpp - 🎮 Fully featured terminal version of the game “2048”.

[C] 2048-AI - 2048 game with a smart AI that can reach the 8192 block.

[Lua] 2048.lua - lua implementation of the popular game “2048”. This is the first game of the author, so the code might not be very beautiful (as the author advises).

[C#] 2048.cs - Console version. The implementation is pretty customizable. You can tweak the size of the canvas and the probabilities of 2s and 4s, etc. Just compile and run from console. Should work with both .NET and Mono.

[Swift] swift-2048 - A working port of iOS-2048 to Apple’s new Swift language. Like the original Objective-C version, swift-2048 does not rely upon SpriteKit. See the description for iOS-2048 for more information.

[React] 2048-react - The game logic is implemented in board.js. It was much cleaner at first, but in order to get movement animations, a lot of state needs to be saved for each of the tiles on the board.

[Sed] sed2048 - This is a sed implementation of the 2048 game. All of the game logic is in sed. Bash is used to supply the sed script with user input and with pseudo-random numbers.

[Idris] idris2048 - This project ports the game 2048 to the dependently typed programming language Idris.

[Assembly/Atari 2600] 2048 2600 - A port of the 2048 game to the Atari 2600 platform.

[Assembly/Gameboy] 2048-gb - A gameboy port of the game 2048.

As always, you can play the mosts popular version of the game here.


👾 Free Tetris Online
😍 Emoji Homepage