From f906c5d984c5f39f7b9d152bb57fba8459914e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 11 Sep 2020 00:20:38 +0200 Subject: wip L2 and L1 const --- labb1/src/life.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'labb1') diff --git a/labb1/src/life.cpp b/labb1/src/life.cpp index cf5c6c9..1f582f6 100644 --- a/labb1/src/life.cpp +++ b/labb1/src/life.cpp @@ -11,7 +11,7 @@ * Print a representation of the grid. * Alive cells show as 'X', dead show as '-'. */ -void printGrid(Grid &grid) { +void printGrid(const Grid &grid) { for (int y = 0; y < grid.numRows(); y++) { for (int x = 0; x < grid.numCols(); x++) { if (grid.get(y, x)) { @@ -27,7 +27,7 @@ void printGrid(Grid &grid) { /* * Return 1 if (x, y) is in bounds and alive, otherwise 0. */ -int checkPoint(Grid &grid, int y, int x) { +int checkPoint(const Grid &grid, int y, int x) { return grid.inBounds(y, x) && grid.get(y, x) ? 1 : 0; } -- cgit v1.2.1