Skip to content
Permalink
Browse files
Added a function so that individual squares can be checked outside th…
…e grid object
  • Loading branch information
hortonr6 committed Aug 11, 2019
1 parent f4b0810 commit f0baec390c4d4ee1a2f975821b5ba4e506817bcb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
@@ -110,3 +110,13 @@ void Grid::resetGrid()
grid[i] = blankGrid[i];
}
}

char Grid::viewSquare(int position)
{
if(position >= 0 && position <= 8)
{
return this->grid[position];
}

return 'F';
}
2 Grid.h
@@ -12,6 +12,8 @@ class Grid
void printGrid();
int checkChoice(char symbol, int input);

char viewSquare(int position);

private:
const char blankGrid[9] = {'1', '2', '3', '4', '5', '6', '7', '8', '9'}; // Used to reset the main game grid
char grid[9] = {'1', '2', '3', '4', '5', '6', '7', '8', '9'}; // Grid the game is played on and that is displayed to the user

0 comments on commit f0baec3

Please sign in to comment.