code: def main():
      # env = gym.make("FrozenLake-v0", is_slippery=False)  # 0 left, 1 down, 2 right, 3 up
      # env = FrozenLakeWapper(env)
  
      env = gym.make("CliffWalking-v0")  # 0 up, 1 right, 2 down, 3 left
      env = CliffWalkingWapper(env)
  
      agent = SarsaAgent(
          obs_n=env.observation_space.n,
          act_n=env.action_space.n,
          learning_rate=0.1,
          gamma=0.9,
          e_greed=0.1,
      )
  
      is_render = False
      for episode in range(500):
          ep_reward, ep_steps = run_episode(env, agent, is_render)
          print(
              "Episode %s: steps = %s , reward = %.1f"
              % (episode, ep_steps, ep_reward)
          )
  
          # 每隔20个episode渲染一下看看效果
          if episode % 20 == 0:
              is_render = True
          else:
              is_render = False
      # 训练结束，查看算法效果
      test_episode(env, agent)
  
imports: import gym
  from gridworld import CliffWalkingWapper, FrozenLakeWapper
  from agent import SarsaAgent
  import time
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types