ntasfi / PyGame-Learning-Environment

PyGame Learning Environment (PLE) -- Reinforcement Learning Environment in Python.
MIT License
1.02k stars 231 forks source link

Something wrong happened when I run a demo #28

Closed Helicqin closed 6 years ago

Helicqin commented 7 years ago
from ple import PLE
from ple.games.pong import Pong
game = Pong()
p = PLE(game, fps=30, display_screen=True, force_fps=False)
p.init()
myAgent = MyAgent(p.getActionSet())

nb_frames = 1000
reward = 0.0

for f in range(nb_frames):
    if p.game_over(): #check if the game is over
        p.reset_game()
    obs = p.getScreenRGB()
    action = myAgent.pickAction(reward, obs)
    reward = p.act(action)

This is my test code.But it did not succeed.The error is:

NameError: name 'MyAgent' is not defined I did not find MyAgent class in PLE or Pong ,anywhere.So,how can I run the code?

Thanks for all kind humans!

Turingwy commented 7 years ago

MyAgent is not a specific class in PLE or any other package, you need write a agent class like MyAgent.py by yourself.