PuzzleSolver/Source/header/solve.h

53 lines
1.3 KiB
C
Raw Normal View History

#ifndef SOURCE_SOLVE_H
#define SOURCE_SOLVE_H
#include <vector>
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
2017-11-18 08:36:50 +01:00
using namespace std;
class coor
{
public:
unsigned int col, row;
coor(int newcol=-1,int newrow=-1): col(newcol), row(newrow)
{}
};
2017-11-18 08:36:50 +01:00
class LogEntry
{
public:
map<Part*, float> PieceCollector;
2017-11-18 08:36:50 +01:00
int abstractionLevel;
2017-11-21 10:31:48 +01:00
coor myCoor;
void advance(){abstractionLevel++;}
void Set(){set=1;}
bool isSet(){return set;}
void advanceRandomed() { randomed++;}
void decreaseRandomed() { randomed--;}
int hasRandomed(){return randomed;}
2017-11-18 08:36:50 +01:00
LogEntry()
{
2017-11-21 10:31:48 +01:00
myCoor = coor();
2017-11-18 08:36:50 +01:00
abstractionLevel=0;
set=0;
2017-11-18 08:36:50 +01:00
}
private:
bool set;
static int randomed;
2017-11-18 08:36:50 +01:00
};
bool next(vector<LogEntry>& log, vector<Part*>& p_Box, Puzzle& puzzleMat);
coor calculateNextCoor(vector<LogEntry>& log, vector<Part*>& p_Box, Puzzle& puzzleMat);
void solve(vector<LogEntry>& log, vector<Part*>& p_Box, Puzzle& puzzleMat);
void setsolution(vector<LogEntry>& log, vector<Part*>& p_Box, Puzzle& puzzleMat);
bool backtrack(vector<LogEntry>& log, vector<Part*>& p_Box, puzzleMat);
void createNextLogElement(vector<LogEntry>& log, vector<Part*>& p_Box, Puzzle& puzzleMat);
#endif //SOURCE_SOLVE_H