Some philosophical notes and an abstract experiment about the universal problem of entropy.
I am neither a physicist nor a mathematician, but it is clear and easy to understand,
that building a house of cards, is much harder than destroying it.
That requires no explanation. Or the same with the famous Rubik's Cube,
which I still haven't figured out how to put those damn colors back in place.
That ultimately seems to mean that disorder spreads easier than order.
And even though I know there is no way out of it,
I wanted to try it by myself if I could cheat at this universal law :-)
I guess the main reason for the entropy-problem might be that we can't remember the way back.
Means, all the footsteps we have walked till the reached point of disorder,
are gone with the wind. It seems to be too expensive to remember them.
So if I could remember the path I walked to disorder them,
(in a script I could do that, by saving the steps somehow in a list)
I could reorder them, with the "same" amount of steps that I needed to disorder them.
But still the problem of "costs" is there, because remembering the path costs extra moves.
At least on a binary level.
Just for fun, I wanted to verify the theory by myself
by trying to find a way, to order numbers,
with fewer or the same amount of action moves, than I needed to disorder them.
For that, I made a list of numbers that initially are sorted.
Then I mix them and count the moves I needed for that.
I count as a move, one step in a loop (I know on a binary level it would be much more).
Finally, I applied different ways of sorting the numbers back.
And again I counted the moves that I needed, to put them back in the place they belong.
Initially the entropy convinced me to cheat,
so that entropy would have an even greater advantage than it already has,
on counting the amount of moves to disorder,
by directly changing 2 numbers in one loop-step.
This worked out, and I could reduce numbers to half of the length of the array,
and I even could have reduced it to more if I had tried,
but then I found, to be fair, I should have changed the sorting too,
by trying to reposition two numbers in one loop-step.
And this would work only in some rare cases (like explained in "My simple sort").
So I corrected my hack to count the amount of steps in each loop-step.
For both. The order and the disorder.
So the number of steps for mixing could be reduced more,
but I actually wanted the opposite.
In the end it's just a matter of showing that the number for sorting
cannot be smaller than the number for mixing.
In reality my experiment could look something like this:
I have an amount of number-cards in my hand (sorted) and I mix them (or simply throw them on the floor).
Then I place them one by one, sorted, into my hand and count the moves for doing that.
A philosophical difference I found between reality and script:
In reality, we don't need to mix the cards with our hands.
With one single move, we could let the cards fall down to get mixed.
In the script, we need to take every number one by one to put it somewhere else.
In the script there is no gravity or wind that would do the action moves instead.
Could be hard to count those fuzzy wind-moves.
Just imagine the other way around: the cards in your hand are mixed,
you let them fall down, and they fall sorted on a stack. Easy life.
No webserver needed for the html-page (only tested in Edge-browser).

1). Just to be mentioned: I know this abstract, simplified example
works only because of the "clear line we walk", a gapless and clean list of numbers.
It wouldn't work out that easily if we have an irregular order and gaps, letters, colors, or more complex objects.
And I have not analyzed the problem at the depth that I previously called "binary level",
where I would need to count the moves of shifting the bits on the RAM-memory.
2). The "My simple sort"-algorithm is explained with these unsorted numbers: 3-5-9-6-2-0-1-4-7-8
We loop through those unsorted numbers
and then place each one in a new Array at the index-position where it belongs.
In first place is the number 3
this has to be placed in the new array at the position myArray[3] ==> myArray[_, _, _, 3]
On second place is the number 5
this has to be placed in the new array at the position myArray[5] ==> myArray[_, _, _, 3, _, 5]
and so on ... that's it.
I am sure not to be the inventor of the "My simple sort",
that I have called "My simple sort" just because I have written it without looking and finding it on the net.
It might already have a name that I don't know.
"My simple sort" is a kind of cheating, because we don't find the place where they belong,
we know it just because they are numbers in a straight line/list.
It is the same like the idea to remember the walked path.
Our knowledge about the straight line is pendant to the rememberd path.
This "sorting" works only with a gapless list of numbers.
If we had only three numbers to sort like a million, a million and one, and a million and two,
the Array-length would be a million and three, only for those three numbers :-)
3). All other sorting algorithms have their own strengths that I do not mention here.
One is better at sorting float-numbers or numbers with gaps,
the other is better at sorting alpha-numerical values and so on.
Not of importance in this little experiment.
4) The script-code is not well-written or well-structured, because it is just a "quick-and-dirty-try".
The focus is on (the difference of) the amounts of action moves for ordering and disordering,
displayed in red in the output.
The goal: a better understanding of the problem I'm living in.
