Printing actionspace for Pong-v0 gives 'Discrete(6)' as output, i.e.0,1,2,3,4,5 are actions defined in environment as per documentation, but game needs only two controls. Why this discrepency? Further is that necessary to identify which number from 0 to 5 corresponds to which action in gym environment?

  • $\begingroup$ I think the actions are defined for all Atari games. Some games need all of them some not. It depends on your agent, whether it can figure out which control is for which action or not. $\endgroup$ – BlindKungFuMaster Dec 12 '16 at 11:35
  • $\begingroup$ 'Discrete(6)' is game specific (for Pong), different games have different no. of controls, but why pong needs 6? $\endgroup$ – meet112 Dec 13 '16 at 11:01
  • $\begingroup$ Hey, can you please tell me how to print the this 'Discrete(6)' values? $\endgroup$ – Yousuf Azad Jan 10 at 18:11

You can try the actions yourselves, but if you want another reference, check out the documentation for ALE at GitHub.

In particular, 0 means no action, 1 means fire, which is why they don't have an effect on the racket.

Here's a better way:

| improve this answer | |

You can try to figure out what exactly does an action do using such script:

action = 0  # modify this!
o = env.reset()
for i in xrange(5): # repeat one action for five times
    o = env.step(action)[0]
        o[:,140:142]  # extract your bat
    ).resize((300, 300))  # bigger image, easy for visualization

action 0 and 1 seems useless, as nothing happens to the racket.

action 2 & 4 makes the racket go up, and action 3 & 5 makes the racket go down.

The interesting part is, when I run the script above for the same action(from 2 to 5) two times, I have different results. Sometimes the racket reaches the top(bottom) border, and sometimes it doesn't. I think there might be some randomness on the speed of the racket, so it might be hard to measure which type of UP(2 or 4) is faster.

| improve this answer | |

There seems to be no difference between 2 & 4 and 3 & 5. The inconsistency mentioned by Icyblade is due to the mechanics of the Pong environment.

"Each action is repeatedly performed for a duration of k frames, where k is uniformly sampled from {2,3,4}"

So the action is just repeated a different number of times due to randomness

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.