1. Learn
  2. /
  3. Courses
  4. /
  5. Reinforcement Learning with Gymnasium in Python

Connected

Exercise

Interacting with the Frozen Lake environment

Now you'll navigate the Frozen Lake environment, a grid-based world where actions move an agent in specific directions. Your task is to carefully look at the environment, and manually define a list of actions that will navigate the agent from the start (top left) to the goal (bottom right) without falling into any holes. In the Frozen Lake environment, actions are typically represented as:

  • 0: left
  • 1: down
  • 2: right
  • 3: up

After running your code, be sure to navigate through your plots to see the path taken by using the 'Previous Plot' and 'Next Plot' buttons. This will help you understand the sequence of actions and their outcomes.

gym and plt have been imported along with the render() function and the env variable.

Instructions

100 XP
  • Observe the agent's position on the right and define a list of actions to navigate the agent across the lake to the goal.
  • Execute each action in the list through the for loop.
  • Render the environment after each action to observe the agent's path.