Question: Page number 1 CS 2 1 1 - ProjectProject, Total 1 0 0 pointsSubmission: This is a group assignment. Form a group of ( 2

Page number
1
CS 211-ProjectProject, Total 100 pointsSubmission: This is a group assignment. Form a group of (2 to 3) students and create a single solution file. Every student will submit the same copy as the rest of their group members. Include the name and WSUID of all your group members at the beginning of the file.1. Modify the C++ and header files attached in the program and write the code for the followingfunctions:a. Move board up : move_up(int board[][5], int numrows)b. Move board down : move_down(int board[][5], int numrows)c. Move board left : move_left(int board[][5], int numrows)d. Move board right : move_right(int board[][5], int numrows)APPENDIX:main.cpp#include #include "2048_helper.h"using namespace std;int main(){int size =5;int board[5][5]={{0,4,2,4,0},{0,0,0,0,0},{2,0,2,0,2},{0,0,2,0,0},{2,2,2,2,2},};//while getch == x loop for up down left rightcout << "Initial Board : [5x5] :"<< endl;print_board(board);char choice ='u'; //initializedwhile (choice !='e'){cout << "Please enter choice:{u,d,l,r,e} for UP, DOWN, LEFT, RIGHT, Exit: "<< endl;cout << "Choice: ";cin >> choice;
if (choice =='u')move_up(board, size);else if (choice =='d')move_down(board, size);else if (choice =='l')move_left(board, size);else if (choice =='r')move_right(board, size);insert_random(board, size);print_board(board);}return 0;}2048_helper.h#include #include #include using namespace std;void move_left(int board[][5], int numrows =5){//CODE HERE}void move_right(int board[][5], int numrows =5){//CODE HERE}void move_up(int board[][5], int numrows =5){//CODE HERE}void move_down(int board[][5], int numrows =5){//CODE HERE}void print_board(int board[][5], int numrows =5){cout << endl <<"\t-----------------------------------------"<< endl;for (int r =0; r < numrows; r++){for (int c =0; c <5; c++){if(board[r][c]>0)
cout <<"\t|"<< right << setw(6)<< setfill('')<0){while (true){//generate random location r, cr = rand()% numrows;c = rand()% numrows;//check if emptyif (board[r][c]==0){//add number randomly {2,4}board[r][c]=2*(1+(rand()%2));break;}}}}

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!