The code links this tweet as the source of the idea: https://twitter.com/nicolasdnl/status/1749715070928433161 [nitter: https://nitter.net/nicolasdnl/status/1749715070928433161]
Quote: "The endless fight for #genuary23 #genuary #genuary2024
It's not an original idea, I've seen this before but couldn't put a hand on it."
It says the battle is endless. I wonder if there's any way to mathematically prove that.
It would be interesting to know if it can get into a looping state after which it just repeats previous moves forever. I guess that would be an “end” of sorts.
Because there are a finite number of states, it will always loop.
An interesting question might be around how many distinct loops there are and whether there's some pattern to the loop lengths.
No it wouldn't. The fact that it will pass through every state infinite times doesn't mean it will do it in the same order each time. Each digit of pi has only 10 possible states, but it never loops.
If the state evolution:
(a) is deterministic
(b) depends only on the current state, and
(c) can only occupy a finite number of states
then it will loop.
Pi digits do not satisfy this because while the digit space is finite (10), the next digit depends on more than just the prior digit.
Related (but not the same): https://en.wikipedia.org/wiki/Poincaré_recurrence_theorem
The speed of the balls are changed by a small random amount when they hit a tile, so it's not deterministic.
If it's a deterministic RNG then it just means the state space is very large.
Ooh that’s cool I’ve never seen that before.
By definition… if there’s no end condition, it won’t end ;)
On top of this there's a negative feedback loop. The ball whose territory gets smaller has less distance to travel between hits.
This means that even if there was anything resembling a "win" condition it would be hard to achieve.
One possible win condition would be a ball reaching the opponent's side. That happened in my case, with "night" eventually breaking through to the left-most edge.
You'd think, but I'm currently looking at a 161/863 split which has been pretty stable for a while now. I thought at first that ball speed is being scaled by territory size to cancel out the negative feedback, and the "winning" ball is moving noticeably faster than the losing one, but I can't see that being deliberate in the code. (There is some randomization of speed on a bounce, but it ought to be pure noise.)
EDIT: 120/904 now.
Which makes the name War even better. There is no winner in war and the cycle repeats itself.
It should suffice to check out what happens (code-wise) if one of the "players" has only one square left. Does the "winning" player have a chance to hit that square and conquer it? Or does the program immediately register a collision for the "losing" player, who goes back to two squares?
That could show that it’s endless, but it wouldn’t necessarily show that an end is possible.
I don't believe an end is possible. As one player's territory sprinks, it should quite naturally follow that it will have less travel time, hence more collisions.
s/sprinks/shrinks
The smaller the area, the more bounces its ball gets per time unit compared to the opponent and more chances to expand the area. So any extreme case of one ball being super-confined will be very short-lived.
But it seems that the balls speed increases with a bigger are.
I think the changes to speed are random: https://github.com/vnglst/pong-wars/blob/main/index.html#L16...
From what I can see from a quick glance at the code, you have the causality backwards. Each bounce adds a small random variation to each ball's velocity, and if one of them randomly ends up moving faster, then it will tend to gain more territory.
Well, it seems like there must be a relatively stable equilibrium. As the owned area decreases, the rate of annexation increases.
Mine seems to have reached a meta-stable state after running for a few hours around 320/704, where the ball with less area is bouncing almost vertically, and a nearly flat border between the two.
https://i.ibb.co/7bNTtsK/daynight.png
The first time I opened the link, I kept watching until both balls ended up in a point where they blocked each other between opposite side’s tiles. The was no way to go and they kept bouncing off each other in a tiny space. I wouldn’t call it an end but there was no progress anymore either.
I got to a similar place, but it only lasted one or two seconds, then they got separated and the game continued
I didn’t grab a screenshot, but I did see how the simulation can end. The day and night balls collided with each other at the boundary and got locked in place in a tight infinite loop, and never moved again.
You can see what happens when the left ball has one tile and the right ball has the rest of the tiles:
Each ball will occupy a minimum area of 1x1, so the opposing ball can never occupy 100%
I think further back, part of the idea may have been mine.
https://hachyderm.io/deck/@bazzargh/111829275276749971
Originally I saw https://twitter.com/CasualEffects/status/1390290306206216196 which the author says was based on a pico8 original (which I remember seeing, but can't find now). Those earlier ones had the pong bats as well, but when I did the demake in basic, I couldn't fit the code into a tweet to get the bbcmicrobot to run it. So, I removed the bats.
Mine is a bit slow and janky, @rheolism (I think?) posted back a much faster, smoother version using custom characters instead of plotting, and then I saw a remake of the demake in processing? These things take a life of their own.
Anyway, long ago deleted my twitter account, but dug it out of the archive.