Warning: The Universe's Event Simulator Is a Fierce Adversary for Coders!
Tags: science, programming, softwareengineering, cleancode
Published: 2024-02-13 02:38:45

*Comprehending the laws and boundaries of nature enhances our skills as programmers.*

> TL;DR: Programming is all about making actual simulators and getting a grip on how the universe behaves and what holds it back.

# Introduction

In recent years, a fascinating analogy has emerged, drawing parallels between the universe and a concept familiar to computer scientists: the discrete event simulator. 

The universe operates much like a massive simulation coordinated without a central clock ticking.

Let's dive in...

# Understanding the Universe as a Discrete Event Simulator

Reality operates in discrete increments of time and space. 

Rather than a continuous flow, events unfold at specific points in time, triggering state transitions within the cosmic fabric. 

This concept aligns with the principles of [discrete-event simulation](https://en.wikipedia.org/wiki/Discrete-event_simulation), a computational method used to model systems where events occur at distinct moments.

Time advances in discrete steps, with events driving changes in system states with **indivisible** discrete units of time.

The universe appears to operate on a fundamental level where time and space are quantized, meaning they consist of indivisible units. 

Researchers think that Planck units encapsulate this discretization of spacetime.

Physicists named Planck units after a physicist [Max Planck](https://en.wikipedia.org/wiki/Max_Planck).

# Planck Units and the Fabric of Reality

[Planck units](https://en.wikipedia.org/wiki/Planck_units) represent the smallest possible length, time, mass, and other physical quantities within the framework of quantum mechanics.

Units are derived from fundamental constants such as the [speed of light](https://en.wikipedia.org/wiki/Speed_of_light), Planck's constant, and the [gravitational constant](https://en.wikipedia.org/wiki/Gravitational_constant).

The [Planck length](https://en.wikipedia.org/wiki/Planck_units#Planck_length) represents the smallest possible length scale, approximately *1.616 × 10^-35 meters*.

The [Planck time](https://en.wikipedia.org/wiki/Planck_units#Planck_time), approximately *5.391 × 10^-44 seconds*, marks the smallest possible time interval, beyond which time loses its meaning.

Planck time is the time it takes for light to travel a distance equal to the Planck length in a vacuum.

This minimal duration represents the shortest meaningful interval of time that can be defined within our current understanding of physics.

At durations shorter than the Planck time, the concept of time itself becomes ambiguous, and the laws of physics as we know them break down. 

You can't break plank units in the same way you cannot break [fundamental particles](https://en.wikipedia.org/wiki/Elementary_particle).

Ancient Greeks created the notion of indivisible particles, which they termed "atoms."

The term "atom" originates from the Greek word "atomos," where "a-" means "not" or "un-" and "tomos" means "cut" or "divided." 

Atoms are not the least divisible particle but the brilliant idea remains.

# Implications for Computer Simulations

The analogy between the universe and a [discrete-event simulator](https://dev.to/mcsee/what-is-wrong-with-software-5pa) has profound implications for computer simulations and scientific inquiry. 

{% post https://dev.to/mcsee/what-is-wrong-with-software-5pa %}

Once you acknowledge the [parallels](https://dev.to/mcsee/the-one-and-only-software-design-principle-3086) between the two realms, you can gain new insights into the nature of reality and develop more efficient simulation techniques.

The concept of the universe as a discrete event simulator challenges traditional notions of computation.

In the past, computer scientists had a lot of trouble dealing with infinities, [precision](https://dev.to/mcsee/code-smell-108-float-assertions-40b5) problems, [floats](https://dev.to/mcsee/code-smell-71-magic-floats-disguised-as-decimals-2g7p), and dealing with divisible units.

For example, comparing two dates was always a problem since we usually represent them as arbitrary divisible points in time. 

Navigating non-infinitely divisible money amounts, distances, and other measurements has sparked numerous renowned challenges like the [Genesis mission](https://en.wikipedia.org/wiki/Genesis_(spacecraft)), the [Mars Climate Orbiter](https://en.wikipedia.org/wiki/Mars_Climate_Orbiter), the [Ariane 5 Flight 501](https://en.wikipedia.org/wiki/Ariane_5_Flight_501), etc.

# Conclusion

The universe as a discrete event simulator offers a compelling framework for understanding the fundamental principles governing reality. 

Planck units set a barrier on where to stop diving the measurements.

I am not telling you to model timestamps with plank units precision. 

I am asking you to change your framework and acknowledge we are not dealing with arbitrary precision problems but with finite precision ones.

We should leave problems related to infinities only to math domains, not real-world simulators.