7
$\begingroup$

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?

$\endgroup$
  • $\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
5
$\begingroup$

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:

env.unwrapped.get_action_meanings()
$\endgroup$
3
$\begingroup$

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]
IPython.display.display(
    Image.fromarray(
        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.

$\endgroup$
2
$\begingroup$

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

$\endgroup$

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.