When we talk about physical objects we have a tendency to describe them in three dimensions. That helps us understand the physical size of a thing. The length, width, and depth. Often described as X, Y, and Z in a three-dimensional coordinate system.
This is very helpful.
Once upon a time, we didn't know this, so somewhere back in the past maybe everything was flat because we hadn't discovered the third dimension yet. Perhaps we only had linear movement because we'd not even discovered the second!
I digress. It's what I do. It's an accidental hobby.
Here's the thing... most people simply can't understand the unfathomably large or unfathomably tiny things in life, even when given dimensions. So we often find the fourth dimension, time, a helpful additional measurement to help describe extreme sizes.
Ahh... four dimensions, now we're talking! Space and time. Fancy.
Let me describe some scenarios.
Take for example a tennis ball.
That's easy to understand because most of us have seen or interacted with one. We can describe it to somebody that hasn't though, by using its dimensions. We can simply say that it's a ball that is approximately 7cm in all three dimensions. People understand because it's easy to conceptualize. There is no value in adding our super helpful fourth dimension to this.
Let's take something a bit bigger: 3 miles (or 5 kilometres, they're almost the same).
That's much harder to conceptualize. So we can add our really useful fourth dimension to help articulate how big that is. It's a one-hour walk. Approximately. So people who walk around at an average human pace will have a rough idea of what 3 miles is, by helping the physical dimension out by using time as an additional measurement.
I mentioned that 3 miles and 5 kilometres are almost the same. Yet, if you were to ask an ant, it will assure you that the difference between 3 miles and 5 kilometres, which is about 0.1 miles, is an awful lot. Ask a snail, and I suspect it will have an opinion even stronger than the ant. It may even roll its protruding eyes at you. Context is really important; relative size and all that. Even when you add time. The difference of 0.1 miles is not a lot for a typical human, yet it's a vast distance for ants, snails, and a bewildering amount of small critters. On a molecular level, it's an almost incomprehensible distance.
This isn't about molecules though. Nope! It's about bits, bytes, and pixels.
Why? Because in about 1986, in my pre-teens, when I was well and truly hooked on computers and coding assembly language on an 8-bit Acorn BBC Micro Model B (the very bestest of 8-bit computers, I might add), I had this idea... possibly, dare I say, an epiphany.
Before I move on to what I'm about to describe, let's just remember that helpful fourth dimension, time. I'm deleting it. Just for a moment. Sorry about that.
Without time, everything that has ever been and everything that ever will be happens simultaneously in an instant. There is no past. There is no future. Technically, there isn't even the present moment. However, the present is the closest concept to having no concept of time at all, so feel free to imagine that without time, everything is happening in the present moment; now. When I say "everything", I truly mean "everything". In italics, no less.
For the excitable among you, please disregard alternate realities - we're not going there. Not in this article, anyway.
Right, back on track... remember; time has been temporarily deleted.
Pixels
On the trusty BBC Micro, I started designing games and trying to code them, because game programming was going to be my destiny. No longer was I going to be a forensic scientist. Computers... that is where it was at.
Back then, every budding games programmer was also a pixel artist out of necessity. We would design little characters (sprites), sometimes in colour, sometimes in monochrome, depending on what our graphics capability was.
In the early days, that meant drawing lots of little 8x8 grids on paper and sitting there with a pencil colouring in the blocks, and putting lots of 8x8 grids together to design larger areas or larger characters. At some point, I upgraded and started buying graph paper where the grid was already printed on the paper - ooh, the efficiency gains were crazy! Back in 1986 time hadn't been temporarily deleted, so saving time was useful. I also would not have talked about efficiency gains in 1986, I'd have said something more like "Wow, this is dead fast now".
It didn't take long to realise it was a good idea to code up a sprite maker. So I did. Now I didn't have to draw everything on paper and figure out the binary representation of what I'd drawn, convert it to hexadecimal, and then pop that into my buffer to recall in code. Instead, now I could colour in my sprites, stitch them together on screen, save them, and they were automatically encoded, and I could see the real size version of them. Fantastic! Of course, I do at times reflect on the simple beauty and nostalgia of doing it all by hand, and I certainly appreciate the fundamentals that it taught me.
At some point during this, I had an idea. The possible epiphany.
Why would I go through the creative exercise of designing all these sprites, backgrounds, alternate fonts, or whatever pixelated thing was being conjured up, when I could simply generate them?
Think about it; all I was doing was coming up with appealing and relevant combinations of pixels in an 8x8 grid. Some would be utter nonsense, and others would be classics that would stand the test of the not-yet-temporarily-deleted time. Take for instance the classic space invader, or pac man. They're essentially built around 8x8 pixels, sometimes larger of course and stitched together. You get the idea though.
So I didn't need to go through the creative pains of creating them; having to think about something, try it, alter it, throw it away, and start over.
Just generate them.
All of them.
I will write that again, decorated with italics because it's one of the important parts of this thing you're reading.
All of them.
Every combination of 8x8 pixels could simply be generated and then I just needed to look at them all and decide which I wanted for whatever I was doing.
No matter what I wanted, whether it was a fancy-looking capital letter A written upside down, a cool eye, something representative of a poison bottle, or something that would pass as a frog... it would have been generated. I just had to look at them and pick out the things I wanted.
The idea didn't stop there.
It occurred to me that an 8x8 pixel grid was just a tiny part of the full screen, and if I could generate every possible combination of an 8x8 pixel grid, I could scale that out and generate every combination of the full screen.
The BBC Micro's highest resolution was the nifty "Mode 0 (zero)", with a monochrome resolution of 640x256. Lower resolutions meant more colours, the ever-popular "Mode 2" had all the colours (all 8 of them, ignoring the flashing colours) at the cost of a much lower resolution of 160x256.
So that was the idea and the reason.
The thought process didn't stop there though.
The thought itself progressed to the realisation that everything that could be drawn within the confines of the resolutions and colour availability would be drawn.
Every 8-bit visualisation of everything that has ever been, or ever will be, would be generated.
For every great artwork out there, I would generate the best and closest 8-bit representation of it. For every face on the planet, I would generate an 8-bit representation; with every possible hairstyle and every age of the same person's face. Every piece of text that has ever been written would be written, albeit in fragments - in every language, even hieroglyphs. So every book, every fact, every future news headline, every poem, every lyric, every piece of sheet music to accompany the lyrics... would all be generated. In fact, the very paragraph that you are reading now would also have been generated.
Because it had to be.
It was simply the algorithm doing its thing.
Naturally, the thought process did stop there either, because, why stop at graphics?
The same theory could be applied to sound. Every sound can be digitised, and therefore every sound that has been, or could ever be, could be digitally generated. Every great speech you've heard could be generated, in every language, in every voice, including your own, with some mellow dream-pop music running in the background that suddenly breaks into the sound of running water with a very specific viscosity.
If you bring those together in exactly the right order and do it repeatedly, you will generate every video footage, accompanied by full audio, for everything that... you guessed it, has ever been, or ever will be.
Some of the generated content would be byte-for-byte identical to actual digitised footage of recorded history; not so close that it's indistinguishable, I truly mean a verbatim, artificially generated, byte-for-byte identical artefact. Even for events that have not yet happened.
Because it has to be.
It is simply the algorithm doing its thing.
Everything you have ever seen, or will ever see, or could imagine - good, bad, or downright disturbing - would be generated in ultra-realistic high definition. Even the things you couldn't imagine or wouldn't want to imagine would be generated.
Because it has to be.
It is simply the algorithm doing its thing.
Time
I mentioned that I didn't write the code. I didn't. Although that's not strictly true. I didn't write the code back in 1986, anyway.
How on Earth does all this relate to the unfathomable size of tiny things, and why has time been temporarily deleted?
I'm getting to it. Time was temporarily deleted, remember. So, technically you have all the time in the world when there's no time, and patience isn't even needed because it's a useless concept without time.
Wait, we're not ready for time...
Bits & Bytes
A monochrome 8x8 pixel grid is exactly 64-bits wide.
If that makes no sense, that's okay. It's a series of ones and zeros; 64 of them to be precise, all lined up neatly next to each other. A zero represents a pixel that hasn't been lit up, and a one represents a pixel that has been lit up.
So, going back to the paper I would draw on, I would draw an 8x8 grid, colour some blocks in and leave others empty, then write a 1 in the ones I coloured in and a 0 in the ones that I didn't, then I could take the first 8 and convert that to something called a "byte". Don't worry if you're not technical, this isn't a lesson in binary representation, maths, or anything like that.
On a fundamental level, each one of those ones and zeros is represented by a transistor that is in one of those two states. A simple switch. The fundamental building block of computing. The molecular level of all digital forms; a single 1 or 0. It's called a "bit".
I said it wasn't about molecules. It isn't... and it is... sort of. Digital molecules. Binary "bits".
I am of course ignoring quantum computing, stateless observation, and suchlike.
Digital molecules. Binary "bits".
One bit. This is our tiny thing.
If we take 64 bits and put them together, it is still a tiny thing; it's just not the smallest tiny thing.
Time
Oh, hello, we're back on time, so to speak.
I didn't write the code back in 1986 because of our helpful fourth dimension; time.
When we introduce time, our tiny thing suddenly becomes an unfathomably large thing.
This is why I needed to temporarily delete time. Sorry about that.
Everything I have mentioned, in reality, won't be possible to observe within our own lifetime. So our fourth dimension, which we helpfully used earlier to describe a big thing in three-dimensional space, is suddenly our Achilles heel because it created an unfathomably large size out of a tiny thing.
Damn you, time!
Okay, let's undelete time. It may take a brief moment to catch up.
The Unfathomably Large Size of Tiny Things
As mentioned, an 8x8 monochrome grid is exactly 64 bits.
If you turn that into a regular decimal number (it's 2^64), you get the number 18,446,744,073,709,551,615.
That's a big number.
In words, it's eighteen quintillion, four hundred forty-six quadrillion, seven hundred forty-four trillion, seventy-three billion, seven hundred and nine million, five hundred and fifty-one thousand, six hundred and fifteen.
I told you it was a big number.
In fact, I would go so far as to say that it is an unfathomably large number.
Imagine if you will that we generate every combination of the 8x8 monochrome pixel grid. That is how many combinations would be generated.
This is where time can become helpful again, to describe the unfathomably large size of tiny things.
Imagine further, that you display each combination of the grid for just 1 second.
That's over 584 billion years.
To put that in perspective, according to current scientific understanding, the Earth formed approximately four and a half billion years ago.
I ain't got time for that.
So I didn't write the code.
Instead, I continued being creative and randomly choosing the most appealing and relevant pixels to colour in.
Afterword
When I decided to write this article, I also decided I really ought to finally get around to writing the code. Let's face it, 37 years is a very long time to procrastinate, even for a professional procrastinator.
So I did.
Finally, in 2023, I have written a Python script to show every combination of a monochrome 8x8 pixel grid. You can find the code below, and I've dropped some pre-made sprites in there if you want to start from somewhere interesting.
It has been fun to finally write the code and to also see the first three or four rows generate images that make sense. My favourite so far has been a simple key that it generated... that was enough to prove the concept, and in some ways, is quite poetic.
I suspect I won't be adding an update to let you know when it's finished.
import pygame
import sys
GRID_SIZE = 8
PIXEL_SIZE = 50
WINDOW_SIZE = (PIXEL_SIZE * GRID_SIZE, PIXEL_SIZE * GRID_SIZE)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
pygame.init()
screen = pygame.display.set_mode(WINDOW_SIZE)
clock = pygame.time.Clock()
def draw_grid(grid):
for y, row in enumerate(grid):
for x, value in enumerate(row):
color = WHITE if value == 1 else BLACK
pygame.draw.rect(screen, color, (x * PIXEL_SIZE, y * PIXEL_SIZE, PIXEL_SIZE, PIXEL_SIZE))
def generate_grid(num):
binary = format(num, '064b')
binary_digits = [int(x) for x in binary]
binary_matrix = [binary_digits[i:i+8] for i in range(0, 64, 8)]
return binary_matrix
def main():
# key = 457126
# pickaxe = 33790251778589312
# spaceinvader = 1746410238856420005
# start with zero if you want a blank page, or override with a predefined sprite above
iterations = 0
max_iterations = 2 ** 64
while iterations < max_iterations:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
pause_text = f"Iteration {iterations} of {max_iterations}"
pause_rect = pygame.Rect(0, 0, PIXEL_SIZE * GRID_SIZE, PIXEL_SIZE)
pygame.draw.rect(screen, WHITE, pause_rect)
pause_surface = pygame.font.SysFont('Arial', 20).render(pause_text, True, BLACK)
screen.blit(pause_surface, (0, 0))
pygame.display.flip()
pygame.time.wait(1000) # pause for 1 second
pygame.event.clear()
grid = generate_grid(iterations)
draw_grid(grid)
pygame.display.flip()
iterations += 1
clock.tick(60)
if __name__ == '__main__':
main()
Disclosure
No ants or snails were harmed in the making of this article. I made certain assumptions on the relative scale and speed of ants and snails being subjected to an additional 0.1-mile journey. Rest assured, I did not force, or even request, any ants or snails to partake in such a journey. I may, however, have conversed with some during the writing process. I will let you decide if it was a bidirectional conversation.
No comments:
Post a Comment