DEV Community

Discussion on: 2048 Circle

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.