changed name of layer 1 to layer 0
and slightly modified speedtable: hard coded inverse to make calculation easier
This commit is contained in:
		@@ -5,9 +5,11 @@
 | 
			
		||||
#include "DestructionPower.h"
 | 
			
		||||
 | 
			
		||||
//TODO! Add more layers here!
 | 
			
		||||
 | 
			
		||||
//sets relations of speed for the different layers
 | 
			
		||||
map<int,float> DestructionPower_Properties::SpeedTable =
 | 
			
		||||
        {
 | 
			
		||||
                {1,0.001}
 | 
			
		||||
                {0,0.99}
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -53,7 +55,7 @@ void DestructionPower::DestructionOfSurrounding(const coor constraintCoordinate)
 | 
			
		||||
            m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i] /=divisor;
 | 
			
		||||
        else
 | 
			
		||||
            //create default destructionPower //TODO find some better solution for default
 | 
			
		||||
            m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i] =1-m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SpeedTable[i+1];
 | 
			
		||||
            m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].DestructionArray[i] =1-m_constraintMatrix[constraintCoordinate.col][constraintCoordinate.row].SpeedTable[i];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,7 @@ void setsolution(vector<LogEntry>& log, Puzzle& puzzleMat)
 | 
			
		||||
{
 | 
			
		||||
	//advance number of randomed part count
 | 
			
		||||
	if(log.back().PieceCollector.size()>1) log.back().advanceRandomed();
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	//'set=true' all 4 rotations of pieces in puzzleBox
 | 
			
		||||
	for(int i=0;i<puzzleMat.p_myBox.size();i++)
 | 
			
		||||
		if(puzzleMat.p_myBox[i]->GetPartID()==log.back().PieceCollector.begin()->second->GetPartID())
 | 
			
		||||
@@ -152,7 +152,7 @@ bool backtrack(vector<LogEntry>& log, Puzzle& puzzleMat)
 | 
			
		||||
 | 
			
		||||
void calculateTrueDestructionPower(vector<LogEntry>& log, Puzzle& puzzleMat, float Layerworth) {
 | 
			
		||||
    float destructionPower = sqrt(
 | 
			
		||||
            Layerworth * puzzleMat.dp.m_constraintMatrix[0][0].SpeedTable[log.back().abstractionLevel+1]);
 | 
			
		||||
            Layerworth * puzzleMat.dp.m_constraintMatrix[0][0].SpeedTable[log.back().abstractionLevel]);
 | 
			
		||||
 | 
			
		||||
    //save destructionArray for when coor is done
 | 
			
		||||
    if(puzzleMat.tmp_destructionArray.empty())
 | 
			
		||||
@@ -232,13 +232,13 @@ bool SetBestOrMoreLayersArithmetical(vector<LogEntry>& log, qualityVector& cqVec
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        switch(log.back().abstractionLevel+1)
 | 
			
		||||
        switch(log.back().abstractionLevel)
 | 
			
		||||
        {
 | 
			
		||||
            case 1: threshold = 0.90; break;
 | 
			
		||||
            case 2: threshold = 0.80; break;
 | 
			
		||||
            case 3: threshold = 0.75; break;
 | 
			
		||||
            case 4: threshold = 0.66; break;
 | 
			
		||||
            case 5: threshold = 0.60; break;
 | 
			
		||||
            case 0: threshold = 0.90; break;
 | 
			
		||||
            case 1: threshold = 0.80; break;
 | 
			
		||||
            case 2: threshold = 0.75; break;
 | 
			
		||||
            case 3: threshold = 0.66; break;
 | 
			
		||||
            case 4: threshold = 0.60; break;
 | 
			
		||||
            default: threshold = 0.5; break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user