From 54df760230eea5fa4c2a915101b5371e356d8ed9 Mon Sep 17 00:00:00 2001 From: Jonny007-MKD <1-23-4-5@web.de> Date: Mon, 9 Dec 2013 17:19:20 +0100 Subject: [PATCH] x --- GDE_3_2008/GDE_3.opensdf.!sync | Bin 0 -> 28 bytes GDE_3_2008/GDE_3.vcxproj | 7 ++- GDE_3_2008/GDE_3.vcxproj.filters | 12 ++--- Hazard/Hazard/KV.cpp | 75 +++++++++++++++++++++---------- Hazard/Hazard/KV.h | 7 +-- 5 files changed, 67 insertions(+), 34 deletions(-) create mode 100644 GDE_3_2008/GDE_3.opensdf.!sync diff --git a/GDE_3_2008/GDE_3.opensdf.!sync b/GDE_3_2008/GDE_3.opensdf.!sync new file mode 100644 index 0000000000000000000000000000000000000000..cc66934ecd602918e52ea1aa13a172add50a3c16 GIT binary patch literal 28 KcmZQzzzqNZ8~_0T literal 0 HcmV?d00001 diff --git a/GDE_3_2008/GDE_3.vcxproj b/GDE_3_2008/GDE_3.vcxproj index ab8edc8..c563179 100644 --- a/GDE_3_2008/GDE_3.vcxproj +++ b/GDE_3_2008/GDE_3.vcxproj @@ -28,6 +28,7 @@ Application Static MultiByte + v100 @@ -58,13 +59,14 @@ Disabled WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) - true + false EnableFastChecks MultiThreadedDebug true Use Level3 EditAndContinue + false _DEBUG;%(PreprocessorDefinitions) @@ -74,7 +76,8 @@ true Windows - false + + MachineX86 diff --git a/GDE_3_2008/GDE_3.vcxproj.filters b/GDE_3_2008/GDE_3.vcxproj.filters index 7028ca4..f90c66d 100644 --- a/GDE_3_2008/GDE_3.vcxproj.filters +++ b/GDE_3_2008/GDE_3.vcxproj.filters @@ -63,9 +63,6 @@ Quelldateien - - Quelldateien - Quelldateien @@ -75,6 +72,9 @@ Quelldateien + + Quelldateien + @@ -128,9 +128,6 @@ Headerdateien - - Headerdateien - Headerdateien @@ -140,6 +137,9 @@ Headerdateien + + Headerdateien + diff --git a/Hazard/Hazard/KV.cpp b/Hazard/Hazard/KV.cpp index e594a4e..bc2ee8e 100644 --- a/Hazard/Hazard/KV.cpp +++ b/Hazard/Hazard/KV.cpp @@ -127,7 +127,7 @@ void KV::PrintPrimImplikanten() { PrimImplikant* currentPI = this->globalPic->at(i); - uint X1 = -1, X2 = 0, Y1 = -1, Y2 = 0; // find coordinates for Rechteck + uint overflow = 0; // at which sides the PrimImplikant overlaps for (uint j = 0; j < currentPI->implikanten.size(); j++) { uint currentI = currentPI->implikanten[j]; @@ -136,32 +136,61 @@ void KV::PrintPrimImplikanten() uint h = (currentI >> this->numVarX); // get all bits that make Y (=h) h ^= h/2; - uint x1 = (w + 1) * (this->edgeLength + 1); // Upper coord - uint x2 = x1 + this->edgeLength; // Lower coord - uint y1 = (h + 1) * (this->edgeLength + 1); // Left coord - uint y2 = y1 + this->edgeLength; // Right coord - - X1 = min(X1, x1); - X2 = max(X2, x2); - Y1 = min(Y1, y1); - Y2 = max(Y2, y2); + if (w == 0) + overflow |= 0x1; // left side + else if (w == this->numVarX) + overflow |= 0x2; // right side + if (h == 0) + overflow |= 0x10; // upper side + else if (h == this->numVarY) + overflow |= 0x20; // lower side } - if (currentPI->name.find("|") != string::npos) + switch (overflow) { - this->Rechteck(X1+12, Y1+9, X2-12, Y2-9, RED, TRANS); - } - else - { - uint random = rand() % 10; - X1 += random; - X2 -= random; - Y1 += random; - Y2 -= random; - if (currentPI->implikanten.size() == 1) - this->Rechteck(X1, Y1, X2, Y2, GREEN, TRANS); + case 0x33: // all 4 edges + break; + case 0x30: // overflows from top to bottom + break; + case 0x03: // overflows from left to right + break; + default: + uint X1 = -1, X2 = 0, Y1 = -1, Y2 = 0; // find coordinates for Rechteck + for (uint j = 0; j < currentPI->implikanten.size(); j++) + { + uint currentI = currentPI->implikanten[j]; + uint w = (currentI & ((0x1 << (this->numVarX)) - 1)); // get all bits that make X (=w) + w ^= w/2; + uint h = (currentI >> this->numVarX); // get all bits that make Y (=h) + h ^= h/2; + + uint x1 = (w + 1) * (this->edgeLength + 1); // Upper coord + uint x2 = x1 + this->edgeLength; // Lower coord + uint y1 = (h + 1) * (this->edgeLength + 1); // Left coord + uint y2 = y1 + this->edgeLength; // Right coord + + X1 = min(X1, x1); + X2 = max(X2, x2); + Y1 = min(Y1, y1); + Y2 = max(Y2, y2); + } + + if (currentPI->name.find("|") != string::npos) + { + this->Rechteck(X1+12, Y1+9, X2-12, Y2-9, RED, TRANS); + } else - this->Rechteck(X1, Y1, X2, Y2, BLUE, TRANS); + { + uint random = rand() % 10; + X1 += random; + X2 -= random; + Y1 += random; + Y2 -= random; + if (currentPI->implikanten.size() == 1) + this->Rechteck(X1, Y1, X2, Y2, GREEN, TRANS); + else + this->Rechteck(X1, Y1, X2, Y2, BLUE, TRANS); + } } } } diff --git a/Hazard/Hazard/KV.h b/Hazard/Hazard/KV.h index 2d67ad5..e3cdf13 100644 --- a/Hazard/Hazard/KV.h +++ b/Hazard/Hazard/KV.h @@ -1,7 +1,6 @@ #include "stdafx.h" #include #include -#include #include "Cell.h" #include "CellCollection.h" #include "PrimImplikantCollection.h" @@ -10,6 +9,10 @@ extern uint dimension; extern uint numElements; extern bool KNF; + +#ifndef _KV_H +#define _KV_H + class KV { public: @@ -61,7 +64,5 @@ private: }; -#ifndef _KV_H -#define _KV_H #define CENTER SINGLE_LINE|CENTER_ALIGN|VCENTER_ALIGN #endif \ No newline at end of file