3 ms·
Think about Gödel numbering or Cantor diagonalization. Let's assume discrete, rectangular representations of images (width, height in pixels and colorspace of
by fizx 17y ago
Think about Gödel numbering or Cantor diagonalization.
Let's assume discrete, rectangular representations of images (width, height in pixels and colorspace of #000000-#FFFFFF). Here's an injective mapping from natural numbers (the indices of the vector of images) to actual images:
# In a C-like language where ** is
# the exponentiation operator, and
# ints are unbounded.
int colors = 0xFFFFFF + 1;
int i = 0;
vector images = new vector();
while(i++) {
for(int width = 1; width < i; width++) {
int height = i - width;
int area = width * height;
int pixels[area];
int combinations = colors ** area;
for(int c = 0; c < combinations; c++) {
for(int p = 0; p < area; p++) {
pixels[p] = c % (colors ** (p + 1));
}
images.append(new image(width, height, pixels));
}
}
}