DEV Community

Cover image for 2048 Circle
Kira L
Kira L

Posted on • Updated on

2048 Circle

For those of you who love the game 2048, please check out my new variation: 2048 Circle!

There are a ton of variations on the game (in fact, the game itself is a variation of 1024), however none have experimented with a non-square board. When the board is a circle, the game becomes just a bit harder to predict, so there is no simple strategy.

I made this game from scratch, not by forking the original game. If you are interested in making your own 2048 variation, check out the GitHub repository. Using some fancy array tricks, I was able to create the whole thing with just around 200 lines of JavaScript.

Lastly, check out the product hunt page for more info.

Hope you enjoy!

Top comments (2)

Collapse
 
amt8u profile image
amt8u

If you have not copied and created the game by yourself. Good Job:-)

Just a suggestion though - You can create functions in your move.js file. I can see the below line repeated having mostly the same logic.

tiles.filter(i=>i.x==0).sort((a,b)=>a.y-b.y).forEach((item, index, all)=>{item.yN=index+2; checkSame(item,index,all,"y",-1);});
Collapse
 
i8sumpi profile image
Kira L

The function checkSame does that partly. You might notice that each line is a little bit different based on the location and direction, so I found it easier to just write this part out.