PuzzleSolver/Source/header/solve.h
Raphael Maenle ce5e007bc7 Removed lots of slack, edited map functions into dispatcher, puzzleMat missing
Removed overconstructed logic, changed vector to map. PuzzleMat object not defined yet, for implementation, make the functions that have already been called through it.
2017-12-20 18:23:39 +01:00

48 lines
1.3 KiB
C++
Executable File

#include <vector>
#include <iostream>
#include "input.h"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
class coor
{
public:
unsigned int col, row;
coor(int newcol=-1,int newrow=-1): col(newcol), row(newrow)
{}
};
class LogEntry
{
public:
map<Part*, float> PieceCollector;
int abstractionLevel;
coor myCoor;
void advance(){abstractionLevel++;}
void Set(){set=1;}
bool isSet(){return set;}
void advanceRandomed() { randomed++;}
void decreaseRandomed() { randomed--;}
int hasRandomed(){return randomed;}
LogEntry()
{
myCoor = coor();
abstractionLevel=0;
set=0;
}
private:
bool set;
static int randomed;
};
bool next(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 setsolution(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat);
bool backtrack(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, puzzleMat);
void createNextLogElement(vector<LogEntry>& log, vector<PuzzlePiece*>& p_Box, Puzzle& puzzleMat);