Question: 2048 game SCORING algorith question. So there is this game I made for my class called 2048 (there are a bunch of free versions on
2048 game SCORING algorith question. So there is this game I made for my class called 2048 (there are a bunch of free versions on the app store) where you have a 4x4 grid of randomly generated blocks and you swipe left/right/up/down to move ALL of the blocks in that direction. Everytime you swipe, a new 2 block appears. If 2 blocks collide into eachother, and they have the same number, then they combine and form a single tile with the value 2x the original of each tile. Here is a video: https://www.youtube.com/watch?v=jO6vclv7eGI)
I need help creating the scoring part. Everytime 2 tiles "merge" the new value is added to your score. EX ([8] [8] [4] [4]) Score: 0............ <-----............([16] [8] [ ] [ ]) Score: 24. How i'm doing it is making each new tile's value += to an updated_score = 0 (AFTER A MERGE HAPPENS). Then in the end i use a double for loop (row/column) to analyze each tile's updated_score value in order to create the score. I have no idea how to do it so that it matches the score on my phone though.
WHAT I THOUGHT WAS HOW IT IS DONE:
[t32, t8 , t256, t4 ] [ t8 , t2, t128, t16] [t16, t64, t8 , t4 ] [ t2 , t8 , t32 , t2 ] I was expecting a score of 1116 since I thought (since I thought the actual scoring looked like this):
t4 = 4 t8 = 4+8 t16 = 4+8+16 t32 = 4+8+16+32 t64 = 4+8+16+32+64 etc... (take the sums of the grid's tile's) However, on my phone it says my score is 3192... Please help.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
