QB64.org Forum
Active Forums => Programs => Topic started by: romichess on December 25, 2019, 08:23:49 pm
-
About 35 years ago I embarked on a journey of the mind quite by accident. I thought my idea would just be called Pixel Wars. Soon however, I discovered I had stumbled upon pseudo evolution and it became Evolve, instead. The idea is simple. Fill the screen with random colored pixel and apply one or more rules to those pixels. Here is the very first rule that at the time I named Pixel Wars.
Then magic happened. Patterns developed that resembled living systems. And patterns combined to form what resemble living organisms. The universe has probably thousands if not millions of rules. And yet this was the result from just one rule!
Next I wanted to see what just one entity, as I came to call them, would look like. But I made a mistake and deleted one line of code. What happened is that the entity was unstable and the result was the Big Bang and the "formation of the Universe".
x = screenw / 2
y = screenh / 2
c = 0
CIRCLE (x
, y
), radius
, c
, radian
, (radian
+ 0.3925) c = c + 1
repeat = -1
eat1 = c + 1
Still wanting to see what only one correct entity would do ...
x = screenw / 2
y = screenh / 2
FOR radius
= 1 TO screenw
/ 2 c = 0
CIRCLE (x
, y
), radius
, c
, radian
, (radian
+ 0.3925) c = c + 1
repeat = -1
eat = c + 1
However, on an 80386 it was taking way to long. The next idea was to do pseudo randomness and select every pixel only once before repeating so I divided the screen into 10 x 10 squares and did each pixel in turn. And yes it is magnitudes faster. It is so fast that _LIMIT 60 was added to be able to see it evolve. And one would never guess in a million years the resulting pattern.
repeat = -1
x = scrnx + boxx
y = scrny + boxy
eat = c + 1
After scratching my head over that one for a while I decided to select randomly within each 10 x 10 block. However, it was changed to a 4 x 4 block because it did not seem to be doing much. The 4 x 4 block was similar but I did notice a few "living" systems start to form. But they remained chaotic and did not form stable entities. It is a mystery. I finally solved the mystery though. This approach to even random coverage does not produce spiral entities. Therefore there are no spiral arms to "sweep away" the chaos. Therefore the "living systems" do not evolve. I thought at the time that maybe it would then eventually die off. So I let it run for days. I'm not sure what the block size was as it was 35 years ago. Then a spiral entity did form and did sweep all the unorganized life systems away. I suggest not running this one unless you have a spare PC to run it on.
That is it for now as I have to get back to my other project. You may wonder how I can remember this after all these years. It was just that fascinating to me. After this stage I started writing my Evolve Engine wherein it remembered all the different rules and I could pick and chose them. Then due to a thunder storm I lost two hard drives on two PC's and it was gone. But by then I had stopped working on it anyway.
-
Cool stuff romichess, thanks!
The one you posted in the Discussion board looking for faster updates brought back a flood of memories from early 90's when playing with cellular automata, chaos, Conway's Life... with QB or early VB. It looked like a version of... ? time for some research :D
Update: here it is
https://en.wikipedia.org/wiki/Cyclic_cellular_automaton
I was remembering devil spirals and it is demon cycles.
Here is my attempt:
_TITLE "Demon Cycle" 'B+ 2019-12-26 CONST xmax
= 800, ymax
= 600, modu
= 16
DIM vs
(xmax
, ymax
), ng
(xmax
, ymax
)
vs(x, y) = ng(x, y)
IF vs
(xx
, yy
) = (vs
(x
, y
) + 1) MOD modu
THEN ng
(x
, y
) = (vs
(x
, y
) + 1) MOD modu:
GOTO skip
skip:
-
Mike, I tried your first program. Quite amazing and lovely. After about 8 minutes on my Core i5 machine I got a structured pattern of spirals (somewhat dependent upon screenw & screenh), with the spiral patterns actually spiralling. But I note that you do not have a RANDOMIZE(TIMER) anywhere in the code. Elsewhere on this forum, the experts have discussed how random is the function RND. So I inserted RANDOMIZE(TIMER) to happen periodically in the loop. I found (twice) that without RANDOMIZE(TIMER) I got spirals, but with RANDOMIZE(TIMER) I did not get spirals (although they may have taken rather longer to form).
-
Ah, so the spirals are a mathematical artifact of the continuous ( cycling ) of a random number generator function. And the reason there were no spirals in the other examples is because that randomization was totally absent or broken up. That explains a lot. Thanks.
-
Cool stuff romichess, thanks!
The one you posted in the Discussion board looking for faster updates brought back a flood of memories from early 90's when playing with cellular automata, chaos, Conway's Life... with QB or early VB. It looked like a version of... ? time for some research :D
Update: here it is
https://en.wikipedia.org/wiki/Cyclic_cellular_automaton
I was remembering devil spirals and it is demon cycles.
Here is my attempt:
_TITLE "Demon Cycle" 'B+ 2019-12-26 CONST xmax
= 800, ymax
= 600, modu
= 16
DIM vs
(xmax
, ymax
), ng
(xmax
, ymax
)
vs(x, y) = ng(x, y)
IF vs
(xx
, yy
) = (vs
(x
, y
) + 1) MOD modu
THEN ng
(x
, y
) = (vs
(x
, y
) + 1) MOD modu:
GOTO skip
skip:
Hmm, seems like the idea of one color eating another color has been thought of by others. Nice example!
-
Ah, so the spirals are a mathematical artifact of the continuous ( cycling ) of a random number generator function.
I do not have the skill or mathematical insight to say that absolutely. But it is a maxim to always be sceptical (naturally) and to be careful with RND. For a third time I did not get spirals with occasional RANDOMIZE(TIMER).
-
I do not have the skill or mathematical insight to say that absolutely. But it is a maxim to always be sceptical (naturally) and to be careful with RND. For a third time I did not get spirals with occasional RANDOMIZE(TIMER).
Thanks Qwerkey for double checking. I did my own investigation. Putting RANDOMIZE TIMER just outside of the iteration loop and running 32000 it just ran too slow. Then 1 to 10 million iteration test:
1,000,000 no spirals
2,000,000 no spirals
3,000,000 chaotic spirals that often broke up
4,000,000 chaotic spirals that did not break up as often
5 to 9 each a little better
10,000,000 pretty close to the original
This in my opinion is proof that the cyclic nature of the RND function is conducive to forming spirals. Good catch!
-
Hello romichess - so here is a deep question for you...if the existence of Chaos is infinite BUT you have place boundaries on your Chaotic universe by the number of pixels displayed on a computer screen, would you conclude that All Chaos which has boundaries seeks to Order itself?
-
Hello romichess - so here is a deep question for you...if the existence of Chaos is infinite BUT you have place boundaries on your Chaotic universe by the number of pixels displayed on a computer screen, would you conclude that All Chaos which has boundaries seeks to Order itself?
The question is a little above my pay grade. But I would say that as long as there are rules in play that allow it, then yes.
-
Mike - Way over my pay grade as well - but I was just thinking the RND function has boundaries like the limitation of your (or anyone's) display screen. Ultimately, as your program seems to prove, BECAUSE of the boundaries, RND will move towards and away from some kind of Order. It's those many monkeys all typing randomly on typewriters who come up with a best selling novel. They were bounded by the alphabet.
-
There is doubtless a whole branch of mathematics devoted to chaos and many Ph.D.s will have been awarded for such stuff - they will have looked into boundary effects, I'm sure. For us ordinary people it's just a question of trying the delights of QB64 and seeing what delight happens.
-
All Chaos which has boundaries seeks to Order itself?
Maybe - I point out that the top of a frozen lake is an ordered boundary, while the water underneath can be considered chaotic.
To answer your question it fully it really depends on what the system is able to do with its energy, particularly at the boundary itself. In the case of a wintry lake, it will either entirely freeze or entirely melt after infinite time. Encase some water in a glass/crystal vase, and I again have an ordered boundary with a chaotic inside, but water doesn't interact with, say silica/quartz crystal the way it does with ice.
Hm, I'm just rambling. Good question though.