Live data from Hacker News

Hacking Flappy Bird with Machine Learning

sarvagyavaish.github.io

21–30 of 56 posts

Re: Hacking Flappy Bird with Machine Learning

#21
post #14

I really want to build a Lego Mindstorms robot (or similar) that watches my phone with a webcam, holds a stylus, and plays Flappy Bird. I have played enough (high score 194) that I am pretty sure I know the right strategy, I just want to take human error out of the equation. Are there open source vision libraries that are low-latency enough to play this in real time? Assuming the robot could keep up with some regular…

holy shit you sound like a crack addict

(only with flappy bird) - they say it's addictive but you're taking this to another level. "Man I need to do a Lego Mindstorms robot with a webcam and stylus and OpenCV - I've gotten to 194 but I NEED more. I need to take the human element out of this equation...."

Re: Hacking Flappy Bird with Machine Learning

#26
Neat. You could also probably do this with a genetic algorithm. Thinking out loud here:

- Have a neural network with 6 inputs for:

   - player x
   - player y
   - acceleration speed
   - acceleration direction
   - next pipe mid-point x
   - next pipe mid-point y
- Two outputs of 0 or 1 for click or no-click

The fitness score would be how close the player is to the pipe mid-point. Hopefully, this would cause the bird to stay as close as possible to fly between the pipes. The genetic algorithm would select the best neural network that knows when to flap based on the current input state.

Re: Hacking Flappy Bird with Machine Learning

#27
post #14

I really want to build a Lego Mindstorms robot (or similar) that watches my phone with a webcam, holds a stylus, and plays Flappy Bird. I have played enough (high score 194) that I am pretty sure I know the right strategy, I just want to take human error out of the equation. Are there open source vision libraries that are low-latency enough to play this in real time? Assuming the robot could keep up with some regular…

holy shit you sound like a crack addict (only with flappy bird) - they say it's addictive but you're taking this to another level. "Man I need to do a Lego Mindstorms robot with a webcam and stylus and OpenCV - I've gotten to 194 but I NEED more. I need to take the human element out of this equation...."

Hey, making AIs play games is fun.

Re: Hacking Flappy Bird with Machine Learning

#28
How hard would it be to solve this deterministically?

Can someone comment on the game's physics? I am assuming:

  - constant horizontal velocity
  - gravity
  - flapping implemented via impulse
  - collisions are handled with bounding boxes
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.

Re: Hacking Flappy Bird with Machine Learning

#30
post #28

How hard would it be to solve this deterministically? Can someone comment on the game's physics? I am assuming: - constant horizontal velocity - gravity - flapping implemented via impulse - collisions are handled with bounding boxes 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 de…

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 Done!

Post reply on HN