Need some help with Flappy bird algorithm

Oct 26, 2016 at 6:05pm
Hi

During two previous weeks i have been working on flappy bird algorithm. But i failed. Not exactly on mathematical level but more in implementation level. Namely, i`ll show you this idea
: So, try to imagine coordinate system or sth like this, you know, y - height, x length. And in this system we put bird and columns. At first user inputs two variables, x - length of x field, and n - amount of columns. Now we have to create simply loop for(i=0; i<n; i++), now we put there three variables (c, b, e), n times. c - is number of column location on x, b - is the beginning of hole in the column, and e - is the end of whole in column. Now we have to create algorithm about: How count amount of click, needed to complete game. Also location of bird is x=0 and y = 0. bird can move x++,y--, or x++,y++, jump ++.

I`am glad to every sugestion about code or algorithm. I created some codes but every had a mistake in logic. The beginning idea was: we have to substract x from b then check the height of bird in relation to begnning of hole. But it`s wrong for sure, i used about 20 for statements and 2 loops.

Ps. Don`t say my english is bad, i know it, it isn`t my native language.
Oct 26, 2016 at 8:25pm
Just do collision detection in the standard way.

What is the shape of the bird's collision box? Are your columns always axis-aligned?
The simpler the collision boxes are, the easier it is to code.

If both the bird and columns are axis-aligned rectangles, then collision between them can be done in a single line of code. Circles are similarly easy too.

When you start playing with compositions of convex polytopes, collision detection becomes complicated. Hopefully you don't need anything so sophisticated.
Oct 26, 2016 at 9:24pm
The columns are always integer. I just have to write algorith that will count numbers of click needed to complete tour:

These are example inputs:

4 11 // 4-amount of columns(n) 11-x field (x)
4 1 4 // 4 is the number on x where column is located and (1,4) - hole
7 -1 2 // -//-
8 -1 3 //
9 0 2 //
Well, i dont have to write real collision mechanism just program that will cound clicks/jumps. But it is really hard.
Oct 27, 2016 at 1:58am
Can you post what you have tried?
Last edited on Oct 27, 2016 at 2:54am
Oct 27, 2016 at 2:45am
SakurasouBusters wrote:
Send me a private message.


I would strongly suggest not sending this troll a private message.
Topic archived. No new replies allowed.