3 ms·
...did you read the actual article? It's explicitly about how instead of stepping the simulation by a time delta you can instead use "animation"-style where you
by Joker_vD 4y ago
...did you read the actual article? It's explicitly about how instead of stepping the simulation by a time delta you can instead use "animation"-style where you take the time point and derive state straight from it, without any differential calculus:
def ball_position(time):
if time < 0:
return (0, 0)
stop_time = 2 * Y_VELOCITY / GRAVITY
if time > stop_time:
return (X_VELOCITY * stop_time, 0)
x = X_VELOCITY * time
y = (Y_VELOCITY - GRAVITY * time / 2) * time
return (x, y)
- pshirshov 4y agoCan you do it for the game of life? Pretty please?
- Joker_vD 4y agoI am pretty certain there is no general closed-form solution for Game of Life because it's Turing-complete; although for some initial configurations (gliders etc.) you can have a simple (or not so simple) expression, in the general case you simply have to simulate it step by step, no other way around it.