Inspiration

I've been playing 2048 for 4 years, I have reached the absolute maximum tile of 131074 on a 4x4 grid, now that I've learned some beginner coding, I thought it's a perfect challenge for me to reconstruct one of my favorite mobile game.

What it does

It's simply a 2048 game, you reach 2048, you win(kinda), play in any size you want, and move those tiles around to get to 2048 before you lose!

How we built it

I reconstructed the 2048 grid with a n x n matrix and created a gamestate and grid class, the first of which tracks things like score and record and if you've won or lost, the later of which contains the actual grid as an instance variable "layout" and handles all the operations (movements).

Challenges we ran into

It's hard to figure out when exactly can you move the grid in a certain direction (at least one row needs to have some empty spaces etc) and what to do (combine the same tiles, etc) after you execute a move.

Accomplishments that we're proud of

I guess I'm just happy in general that I managed to pull this off at all. If any thing, I'd say I'm particularly happy I managed to allow the game to have any dimension instead of just 4x4.

What we learned

I really enhanced my knowledge of list comprehension and object oriented programming.

What's next for Simple 2048 game

With more knowledge, I'm excited to implement the front end of the game (a clearer presentation, better command inputs, different colors for different tiles etc), and maybe some multiplayer feature (leaderboards etc). The ultimate goal is to write algorithms that can auto play the game using deep learning.

Built With

Share this project:

Updates