From 98db209c9008492baec6bb482b047d386fbdd42b Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Sat, 9 Nov 2019 14:23:42 -0800 Subject: One down, 522 to go. --- Source/Puzzle.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'Source/Puzzle.h') diff --git a/Source/Puzzle.h b/Source/Puzzle.h index 7a98a78..94cb4b0 100644 --- a/Source/Puzzle.h +++ b/Source/Puzzle.h @@ -37,7 +37,6 @@ struct Decoration { int count = 0; }; - struct Cell { inline static Cell Undefined() { Cell c; @@ -63,7 +62,9 @@ struct Cell { struct Negation {}; struct Pos {int x; int y;}; -struct Puzzle { +#include // TODO: Move this + impl to cpp +class Puzzle { +public: int16_t height; int16_t width; bool hasDecorations = false; @@ -72,6 +73,10 @@ struct Puzzle { Symmetry sym = Symmetry::NONE; bool pillar = false; + bool valid; + std::vector negations; + std::vector invalidElements; + inline Cell GetCell(int x, int y) const { x = Mod(x); if (!SafeCell(x, y)) return Cell::Undefined(); @@ -80,13 +85,24 @@ struct Puzzle { inline Cell::Color GetLine(int x, int y) const { return grid[x][y].color; } + inline void NewGrid(int newWidth, int newHeight) { + if (newWidth == 0) { + assert(false); + newWidth = width; + newHeight = height; + } else { + // @Cleanup! This should be in the ctor... + width = 2*newWidth + 1; + height = 2*newHeight + 1; + } + grid.clear(); + grid.resize(width); + for (int x=0; x negations; - std::vector invalidElements; - // private: std::vector> grid; -- cgit 1.4.1