Skip to content

Instantly share code, notes, and snippets.

@aarohmankad
Created December 7, 2017 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarohmankad/cc6bd119d0ab9cf8b1c2799d9037e50e to your computer and use it in GitHub Desktop.
Save aarohmankad/cc6bd119d0ab9cf8b1c2799d9037e50e to your computer and use it in GitHub Desktop.
An example of handling some simple edge cases
vector<pair<int, int>> findCells(const vector<pair<int, int>>& gameBoard, const int FLAG_CODE) {
if (gameBoard.empty()) {
return vector<pair<int, int>> {};
}
vector<pair<int, int>> cells;
for (pair<int, int> cell : gameBoard) {
if (cell.second == FLAG_CODE) {
cells.push_back(cell);
}
}
return cells;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment