Tap numbers

(Dall-e creation)

The general idea is to turn on a tap and let numbers flow, digit by digit, onto the central square of an infinite strip of paper. Even digits go to the left, odd digits to the right. Collisions of digits can occur – but in the end, the situation calms down and the positions freeze. Until the tap lets out the next number.

Detailed rules
1) Let's say the number that comes out of the tap is 102.
2) The leftmost digit of 102 is "1" and this 1 "lands" first on the "central square" placed under the tap.
3) Two cases can arise when a digit "d" lands on a square: either this square is occupied by another digit (say "f", with "f" ranging from 0 to 9) or it is empty.
3a) If a digit "d" lands on an empty square ("empty" means that even the digit zero is not present), then "d" stops there.
3b) If a digit "d" lands on an square already occupied by another digit "f", we compute "s" = (d + f).
3b1) If "s" is < 10 and even, we move "s" by s squares to the left; if "s" is < 10 and odd, we move "s" by s squares to the right.
3b2) When "s" is greater than 9 this means that "s" is a 2-digit number, the first digit being 1 and the second being (say) k.
3b3) In this case we split 1 and k – moving first the digit 1 (to the right, one square). If this new landing square is not empty we iterate the procedure until 1 (or one of its avatars) lands on an empty square.
3b4) When 1 (the leftmost digit of "s") has found an empty square, it stays there: but remember, a square where a sum took place must expell all the digits of "s". So we must move k now – to the right (k squares) if k is odd, or to the left (k squares), if k is even. Again, we iterate until k finds an empty square. 

Examples
Say we have the hereunder configuration, with the number 18993 already on the infinite horizontal strip, and its digit 1 on the "central square" (the "central square" is always vertical to the tap).
We now open the tap T and the integer 27 appears.
We first allow the digit 2 of 27 to land on the central square (and temporarily hold the digit 7).
As this landing square is already occupied by the digit 1 of 18993, we get "s" = 1 + 2 = 3.
This 3, being odd, will now slide 3 squares to the right – turning the last "9" into 12.
This 12 (being > 9) will be split into the digits 1 and 2 ("2" is the k we've seen before).
We first move the digit 1 and slide it one square to the right – turning "3" into 4.
This 4 slides in turn 4 squares to the left... landing on an empty square, the "central" one. This last move ends the journey of "1" the leftmost digit of 12.
As the square that was previously occupied by 12 must expell all the digits forming "s", we must now (and only now) slide "2" two squares to the left – turning 8 into 10.
The "1" of this 10 goes one square to the right (as 1 is odd)  – turning 9 into another 10.
The "1" of this last 10 goes one square to the right again... ending on an empty square where its journey ends.
The squares on which the last two 10s appeared cannot expell their zeros – so we keep them.
We see now how 18993 has become 4001 with a single "2" (the leftmost digit of 27).
But the story doesn't end here.
Indeed, we must consider the rightmost digit of 27 and see what the "7" produces when it lands on the "central square".
Well, this is explained below: 7 and 4 make 11, the first "1" of 11 goes to the right, turns the  first 0 into 1, this 1 turns the second zero into 1, this 1 turns the last digit 1 into 2, this 2 slides two squares to the left (being even) on an empty square... where it stays.
The second "1" of 11 is expelled one square to the right (being odd), turning the latter 2 into 3.
This 3 is expelled by its square three squares to the right, on an empty square.
End.
We saw how the tap, leaking the number 27, managed to erase 4 out of 5 digits of 18993, leaving 3 exactly at the place it occupied before.

(screenshot of the hereunder table)

A side note : could the first digit of a 2-digit sum “s” interact with the second digit of "s" (after a few left and right slides)? Yes! Though the above rules can handle “the problem”, here is an example:
We open the tap T, and a first integer appears (made of 13 consecutive “8”): 8888888888888. As explained, we examine the effects of one “8” after the other. The first “8” stays on the “central square”, the second turns it into 16 (in pale red italics for a better understanding of the successive steps), the “1” of 16 slides to the right, the 6 slides to the left. Then the 3rd 8 comes, then the 4th, etc.
We see that the arrival of the 8th "8" produces a "5" that comes back to interact with the "6" of "16" (the digit "1" is gone and has produced the said "5" after a few steps).
The mentioned interaction is simply the sum 5 + 6 = 11. And the two "1"s of this "11" will have their normal life.
Another example is given by the arrival of the 12th "8" – which also produces a right-sliding 5, etc.
                                                          T         
                                                          |         
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   |   |   |   |   |   |   | 8 |   |   | 1st 8 out of the tap
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 6 |   |   |   |   |   |16 | 1 |   | 2nd 8 out of the tap
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 6 |   |   |   |   |   | 8 | 1 |   | 3rd 8 etc.
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   |12 | 1 |   |   |   | 2 |16 | 2 |   | 4th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   |   | 1 |   |   |   | 2 | 8 |   |   | 5th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   | 6 | 1 |   |   |   | 2 |16 | 1 |   | 6th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   | 6 | 1 |   |   |   | 2 | 8 | 1 |   | 7th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   | 6 | 5 |   |   |   | 4 |16 | 2 |   | 8th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   | 6 |   |   |   |   |   |5+6|   |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   | 6 |   |   |   |   |   |11 |   |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   | 6 |   |   |   |   |   | 1 | 1 |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   | 6 |   |   |   |   | 2 |   | 2 |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   | 2 |   | 6 |   |   |   |   | 2 | 8 |   |   | 9th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   | 4 |   |   |   | 4 |   |12 | 1 |   |   |   | 2 |16 | 1 |   | 10th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   | 4 |   |   |   |   |   |   | 1 |   |   |   | 2 | 8 | 1 |   | 11th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   | 4 |   |   |   |   |   |   | 5 |   |   |   | 4 |16 | 2 |   | 12th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   | 4 |   |   |   |   |   |   |   |   |   |   |   |5+6|   |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   | 4 |   |   |   |   |   |   |   |   |   |   |   |11 |   |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   | 4 |   |   |   |   |   |   |   |   |   |   |   | 1 | 1 |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   | 4 |   |   |   |   |   |   |   |   |   |   | 2 |   | 2 |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   | 4 |   |   |   |   |   |   |   |   |   |   | 2 | 8 |   |   | 13th 8
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

I guess all this was inspired (unconsciously?) by the SoupAutomat explained there.
And you know what? I dream of someone building online an equivalent "dynamic page" as the one Gilles Esposito-Farèse has computed 15 years ago for the SoupAutomat – page still alive and kicking, thank you Gilles!
We might find interesting things... "gliders" for instance – or some weird things like "a tap which stops flowing when you don't listen" (Marcel Duchamp)!
 (Dall-e creation)

P.-S.
We opened this page with a tap leaking the integer 102: what does 102 become if 102 is the very first number to "fall" (digit by digit) on the central square?
If the rules have been well explained by the author, you will see that 102 doesn't become 3 in the end... but 21.
[This is because the "0" of 102, falling on the "1" already in the central square, produces the sum "s" = 0 + 1 = 1. This last "1", as the result of a sum, must slide one square to the left... leaving the central square free for the "2" of 102.]
I hope I was clear, but I still have doubts!








Commentaires

Posts les plus consultés de ce blog

Confingame, 3e étape

Square my chunks and add

Triples for the new year