October 2018
Intermediate to advanced
472 pages
10h 57m
English
Now, once you have reset the game, all there is to do is play. You can feed your actions/responses to the game with the use of the following code:
action = 0new_state, reward, done, info = env.step(action) print((new_state, reward, done, info))
The env.step function accepts your response/action (move left or right) and generates the new_state/orientation (x, x_dot, theta, theta_dot) of the CartPole system. Along with the new state, the env.step function also returns the reward, which indicates the score you receive for the action you just took; done, which indicates if the game has finished; and info, which has system-related information.
When the game begins, done is set to False. Only when the CartPole orientation exceeds ...
Read now
Unlock full access