Minor style fixes to day 3
This commit is contained in:
parent
5b41f34883
commit
9f01ad0ada
|
@ -27,6 +27,7 @@ std::vector<std::string> read_input(const std::string &filename) {
|
||||||
int findNumTrees(const std::vector<std::string> &input, int xDelta, int yDelta = 1) {
|
int findNumTrees(const std::vector<std::string> &input, int xDelta, int yDelta = 1) {
|
||||||
int xCursor = 0;
|
int xCursor = 0;
|
||||||
int numTrees = 0;
|
int numTrees = 0;
|
||||||
|
// I want to use an iterator here, but I don't have a way to cleanly make sure I don't blow through the end :(
|
||||||
for (int i = 0; i < input.size(); i += yDelta) {
|
for (int i = 0; i < input.size(); i += yDelta) {
|
||||||
const std::string &row = input.at(i);
|
const std::string &row = input.at(i);
|
||||||
numTrees += (row.at(xCursor) == TREE_CHAR);
|
numTrees += (row.at(xCursor) == TREE_CHAR);
|
||||||
|
|
Loading…
Reference in a new issue