1. DP using greedyfrom pyamaze import maze, agentimport numpy as np# Load the Mazesize = 5m=maze(size,size)m.CreateMaze(loadMaze="maze.csv")# create the environment modelstates = list(m.maze_map.keys())actions = ['E','N', 'W', 'S']# define how an action changes a statedef step(state, action): x, y = state if action=='E': y += 1 elif action=='W': y -= 1 elif action=='N':..
Solving Maze using Reinforcement Learning
1. DP using greedyfrom pyamaze import maze, agentimport numpy as np# Load the Mazesize = 5m=maze(size,size)m.CreateMaze(loadMaze="maze.csv")# create the environment modelstates = list(m.maze_map.keys())actions = ['E','N', 'W', 'S']# define how an action changes a statedef step(state, action): x, y = state if action=='E': y += 1 elif action=='W': y -= 1 elif action=='N':..
2024.09.10