decrease file retrieving time
All checks were successful
Linux arm64 / Build (push) Successful in 2m29s
All checks were successful
Linux arm64 / Build (push) Successful in 2m29s
This commit is contained in:
@@ -7,30 +7,29 @@
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
|
||||
using PolyominoData = std::array<std::uint64_t, 4>;
|
||||
|
||||
/**
|
||||
* A mathematical object consisting of touching squares on a 2D grid
|
||||
*/
|
||||
class Polyomino {
|
||||
public:
|
||||
static const std::size_t POLYOMINO_DATA_SIZE = 4;
|
||||
using PolyominoData = std::array<std::uint64_t, POLYOMINO_DATA_SIZE>;
|
||||
|
||||
private:
|
||||
PolyominoData positions; // the squares composing the polyomino, stored in binary. MSB is downleft
|
||||
std::int8_t length; // the size of the smallest square box in which the polyomino can fit on any rotation
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a polyomino with the specified positions and normalizes it, wheter it is actually a polyonimo is not checked
|
||||
*/
|
||||
Polyomino(PolyominoData&& positions);
|
||||
|
||||
/**
|
||||
* Creates a polyomino with the specified positions and length, wheter it is actually a polyonimo of this length is not checked
|
||||
*/
|
||||
Polyomino(PolyominoData&& positions, std::int8_t length);
|
||||
|
||||
// this is temporary. They are here for compatibility reasons for now
|
||||
/**
|
||||
* Creates a polyomino with the specified positions and normalizes it, wheter it is actually a polyonimo is not checked
|
||||
*/
|
||||
Polyomino(std::set<Position>&& positions);
|
||||
Polyomino(std::set<Position>&& positions, std::int8_t length);
|
||||
|
||||
/**
|
||||
* Translates the polyomino to the lowest unsigned values (lower row on y = 0, and left-most column on x = 0)
|
||||
@@ -127,9 +126,13 @@ class Polyomino {
|
||||
*/
|
||||
bool contains(const Position& position) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Insert a square at the position
|
||||
*/
|
||||
void insert(const Position& position);
|
||||
|
||||
/**
|
||||
* @brief Removes a square at the position
|
||||
*/
|
||||
void erase(const Position& position);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user