Question: ONLY NEED PART 2 ! 2 0 4 8 GAME - MATLAB ONLY - NO SPECIAL FUNCTIONS Part 2 : Game Play The next step

ONLY NEED PART 2!2048 GAME- MATLAB ONLY- NO SPECIAL FUNCTIONS
Part 2: Game Play
The next step is develop code to move the tiles in either the up, down, left, or right direction.
Given the location of the tiles, calculate how the tiles and score will change for each move. Create
the following function:
MakeMove
Summary: Given the board as a 4x4 matrix, determine the new board after moving
left, right, up, or down
Inputs: board (4x4 matrix), direction (string value)
Outputs: new board (4x4 matrix), score (numeric value)
Syntax: function [new_board,score]= MakeMove(board,direction)
Example to move left: [new_board,score]= MakeMove(board,'left');
Play the 2048 game to properly understand how the values change when they are shifted. This would be important and you can define a sample matrix like board =[2244; 2088; 4044; 2424] to test different board arrangements.
ADDITIONAL INSTRUCTIONS
In part-2 you do not have to generate a new number at a random position. You have to just make a move in a direction given by the user. Your program should work for all the four possible moves.
Whenever 2 numbers combine, the score is incremented by the total of both the numbers. For example: [4048], when shifted to left becomes [8800]. So the score increases by 8(as two 4s get combined).
ONLY NEED PART 2 ! 2 0 4 8 GAME - MATLAB ONLY -

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!