PyGame-Learning-Environment icon indicating copy to clipboard operation
PyGame-Learning-Environment copied to clipboard

bug in flappy bird game

Open adibyte95 opened this issue 6 years ago • 3 comments

position of the keys in state (where state = p.getGameState() and is a dictionary of key value pairs ) changes every time the game is re run

lets us say that in one instance player_vel is the first key as shown in the figure below image

but in another run this changes image

how one is supposed to train an reinforcement learning algorithm with this type of observation inputs

adibyte95 avatar Jul 26 '18 18:07 adibyte95

if you have the same problem take a look at this pull request

adibyte95 avatar Jul 27 '18 16:07 adibyte95

@adibyte95 in python the order of a dict's keys will not be the same between runs. This is because it uses a hashmap under the hood. I would recommend explicitly referring to a quantity you require by the key name. Eg: state["next_pipe_top_y"].

ntasfi avatar Jul 28 '18 05:07 ntasfi

@ntasfi by using an ordered dictionary as compared to ordinary dictionary the keys will be in the same position as they were inserted and will not change during different runs. i know that in an dictionary a value can be easily found through its corresponding key, but if someone tries to use only the values as in my case they will get confused, so i think this is more elegant this way.

adibyte95 avatar Jul 28 '18 06:07 adibyte95