generating "Random" Pieces from picture source now

rgb values stored as double in the piece base class. this is bound to change once other group has expanded piece base class.
This commit is contained in:
Raphael Maenle
2017-12-06 16:25:13 +01:00
parent cd7bc1c42a
commit 9b282e83ca
8 changed files with 100 additions and 73 deletions

View File

@ -3,6 +3,10 @@
class Part
{
public:
double r;
double g;
double b;
Part(): connections(0){}
~Part() {}
uint8_t getConnections() const
@ -13,4 +17,6 @@ public:
private:
uint8_t connections;
};

View File

@ -1,6 +1,10 @@
#include <vector>
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
class PuzzlePiece: public Part
{
public:
@ -114,8 +118,10 @@ class randomBox: public Puzzle
public:
randomBox(unsigned int m, unsigned int n) : Puzzle(m,n) {srand(time(0));} //passed m n to puzzle constructor
void createRandomPuzzle();
void createRandomAbstraction1();
void createRandomAbstraction2();
void putAllIntoBox();
vector<PuzzlePiece> shuffle();
void printBox();
@ -157,24 +163,11 @@ private:
static int randomed;
};
class BoxClassify
{
vector<PuzzlePiece*> p_Box;
vector<vector<PuzzlePiece*>> ab1class;
};
int LogEntry::randomed(0);
unsigned int PuzzlePiece::idcount(0);
void printBox(vector<PuzzlePiece> myBox);
vector<PuzzlePiece> createBox(unsigned int m, unsigned int n);
vector<PuzzlePiece> createBox(coor myCoor);
void numerateBox(vector<PuzzlePiece>& myBox);
bool next(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat);
coor calculateFirstCoor(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat);
coor calculateNextCoor(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat);
void solve(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat);
void abstractionlayer0solver(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat);