Introduction
A quixel is a quantum pixel. Similar to a classical pixel, it is represented with 3 integer values (Red, Green, Blue). However, quixels are in a super position of these 3 states instead of a combination. This super position only lasts until the quixel is observed at which point it collapses to one of three classical pixels; RGB(255,0,0)
, RGB(0,255,0)
and RGB(0,0,255)
.
Specification
- Representation
- Each quixel is represented as an array of 3 integers between 0 and 255, r, g and b respectively.
- Super Positions
- Each quixel is in a super position between the Red, Blue and Green states represented by R, G and B respectively.
- Observation
- When each quixel is observed it collapses into one of the three states. The probability of each classical state is
R = (r + 1) / (r + g + b +3)
,G = (g + 1) / (r + g + b + 3)
andB = (b + 1) / (r + g + b + 3)
. This way each classical state always as a non-zero probability of showing up.
- When each quixel is observed it collapses into one of the three states. The probability of each classical state is
- Input
- The function or program should take a image of quixels. How it does this is flexible. A filename, using a multi-dimensional array, etc are all acceptable.
- Output
- The function or program should produce an image of classical pixels. The data structure for this produced image is also flexible. Note that all of the pixels should be one of these three:
RGB(255,0,0)
,RGB(0,255,0)
andRGB(0,0,255)
- The output should not be deterministic; these are quantum pixels! The same input should result in different outputs.
- If your language has no way of generating a random number, you can take random bytes as input
- The function or program should produce an image of classical pixels. The data structure for this produced image is also flexible. Note that all of the pixels should be one of these three:
- Scoring
- This is code-golf so fewest bytes win.
Images
Mona Lisa by Leonardo da Vinci
Starry Night by Vincent van Gogh
Persistence of Memory by Salvador Dali
Teddy Roosevelt VS. Bigfoot by SharpWriter
RGBK
, whereK=255*3-R-G-B
, then make your quantum pixels be any one of the 4. (If K is selected, display (0,0,0). Extend your RGB equations in the obvious way, changing 3s to 4s, adding K when you would add R+G+B, etc). A blur after doing this should reconstruct a pretty decent noisy copy of the original. (K stands for black or key, in case you wondered) \$\endgroup\$