#pragma once #include #include using namespace std; class gameBoard { private: char board[10][15]; int rows; int columns; //current location of pac person int pacRow; int pacCol; //ooohhh advanced cool thing.... char pacChar; public: gameBoard() { rows = 10; columns =15; pacRow = 5; pacCol = 7; pacChar = 'o'; //Intialize board values for (int r = 0; r < rows; r++) for (int c = 0; c < columns; c++) board[r][c] = '.'; board[pacRow][pacCol] = pacChar; } void display() { for (int r = 0; r < rows; r++) { for (int c = 0; c < columns; c++) { cout << board[r][c]; } cout << endl; } } void move(string dir) { //step 1: delete old pacperson on board board[pacRow][pacCol] = ' '; //step 2: Update pacRow, pacCol if (dir == "u") { pacRow--; pacChar = 'v'; } if (dir == "d") { pacRow++; pacChar = '^'; } if (dir == "l") { pacCol--; pacChar = '>'; } if (dir == "r") { pacCol++; pacChar = '<'; } //step 3: put pacperson back on board in new location board[pacRow][pacCol] = pacChar; } };