For the midterm project, I want to recreate the popular game “2048”.
It starts with a 4×4 grid with two “tiles” on the grid, each displaying the number 2 or 4. The player hit the arrow keys on the keyboard to move the tiles around — and also to generate new tiles, which will also be valued at 2 or 4. When two equal tiles collide, they merge to create a greater tile that displays their sum. The player wins the game if he/she reaches 2048 before the board gets filled up.
Some obstacles I expect to run into include:
- How to assign each grid an index number and track the number on each tile
- How to make use of arrays to keep track of numbers and do the addings
- How to distinguish between rows and columns