Re:Hacking Flappy Bird with Machine Learning
by kenferry on Saturday February 15, 2014 @08:37PM
(#7246274)
If you play the game, it's actually quite trivial to program deterministically. :-) Flapping is not implemented as an impulse. It's more like jumping in Mario - it instantaneously fires a canned "flap" movement that is always the same.
Set flap_height = bottom of next pipe + constant.
If bird height < flap_height, flap.
Done!
Re:Hacking Flappy Bird with Machine Learning
by userbinator on Saturday February 15, 2014 @10:51PM
(#7246574)
It also looks like you'd want to avoid flapping into the top of the pipe.
Re:Hacking Flappy Bird with Machine Learning
by kenferry on Sunday February 16, 2014 @12:22AM
(#7246740)
Perhaps I should have said "threshold_height".
threshold_height = bottom_of_pipe_height + 10 pixels; // or something
if (current_height < threshold_height)
flap
else
don't flap
If you never flap when above the threshold, you will not hit the top.
Re:Hacking Flappy Bird with Machine Learning
by tripzilch on Sunday February 16, 2014 @04:40PM
(#7249452)
In another Flappy Bird thread (the MMO one), somebody posted this formula:
Let distance between ground and top of screen=100.
Bird position after a flap at y=y0, time=t0:
y(t) = y0 + 13.8 - 147 * (t - t0 - 0.288)^2
(https://news.ycombinator.com/item?id=7229018 -- note the original comment had "+ 0.288", but if you plot the graph this was obviously a mistake)I tried it out in my own HTML5/JS Flappy clone (mine's not at all interesting or even done, but I felt I had to give it a try), and the movement seems really accurate.
I have no idea how they got to those numbers, however.
Can someone comment on the game's physics? I am assuming:
Maybe someone who knows something about optimal control (ODE) say whether this is analytically solvable? Of course there's still the practical stuff (numerical integration, I/O lag) to deal with but I'm optimistic.