diff --git a/include/field.h b/include/field.h index ccd0160..8753768 100755 --- a/include/field.h +++ b/include/field.h @@ -1,7 +1,7 @@ #pragma once #include "line.h" -#include "types.h" +#include "types.hpp" #include #include diff --git a/include/line.h b/include/line.h index 08de56f..aa369ae 100644 --- a/include/line.h +++ b/include/line.h @@ -1,4 +1,4 @@ -#include "types.h" +#include "types.hpp" #include diff --git a/include/types.h b/include/types.hpp similarity index 56% rename from include/types.h rename to include/types.hpp index 4f9c837..48ae3bf 100644 --- a/include/types.h +++ b/include/types.hpp @@ -16,4 +16,11 @@ struct Position { Position() : x(0), y(0) {} Position(int x, int y) : x(x), y(y) {} + + bool operator==(const Position& other) const { + return ((this->x == other.x) && (this->y == other.y)); + } + bool operator!=(const Position& other) const { + return !(*this == other); + } }; \ No newline at end of file diff --git a/main.cpp b/main.cpp index 8273c7d..70d90d7 100755 --- a/main.cpp +++ b/main.cpp @@ -5,11 +5,16 @@ using Tile = unsigned long long int; -void printVecOfPos(const std::vector &positions) { - for (const auto &pos : positions) { - std::cout << pos.x << ' ' << pos.y << '\n'; +// [debug] +void printVecOfPos(const std::vector &positions, int fieldSize) { + for (int i = 0; i < fieldSize; ++i) { + for (int j = 0; j < fieldSize; ++j) { + std::cout << (std::find(positions.begin(), positions.end(), Position(i, j)) != positions.end() ? 1 : 0) << ' '; + } + std::cout << '\n'; } } +// [debug] int main() { Field field(4);