Open
Conversation
A small pixelart-matrix is compressed into an ADD. This ADD is then decoded and a new matrix is rebuild. Both matrices need to be the identical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A new test picture.cpp is implemented.
The test converts a 2D input matrix of pixel values into an ADD. The resulting ADD is then converted back into a new 2D matrix. If the new matrix matches the original input, the ADD Test is completed correctly.
step by step description:
A small greyscale picture of a dog represents the input matrix as a set 2D array of pixel values.
Depending on its height and width, the matrix is iterated pixel by pixel.
In the beginning, dependent on the size of the matrix, a set amount of variables is created.
During iteration, these variables are treated as a binary representation of the pixel index.
Each 1 (true) or 0 (false) in this binary number sets the corresponding variable. With all variables set, the ADD can be constructed.
To create the ADD, a DNF is generated.
Each conjunction is an iteration. It consists of the pixel value and every variable.
When those conjunctions get connected with disjunctions, the ADD is complete.
To reconstruct the matrix, the pixel position for each iteration is known. With that information, the correspondingvariable settings can be restored.
To get the pixel value, the ADD gets solved with the belonging variable settings.