reinforcement learning def simp_features(state,action)"""returns list of feature values for the state-action pair ""assert action in simple_game_env actions ( , , ,pstate would go to monster monster_ahead( , ,actionf would crash into wall wall_ahead( , ,actionf action is towards prize towards_prize( , ,action,preturn [ , , , feature-based rl learner this learns linear function approximation of the -values it requires the function get features that given state and an action returns list of values for all of the features each environment requires this function to be provided rlfeatures py -feature-based reinforcement learner import random from rlqlearner import rl_agent from display import displayable from utilities import argmaxeflip class sarsa_lfa_learner(rl_agent)""" sarsa_lfa learning agent has belief-state consisting of state is the previous state is {(state,action):valuedict visits is {(state,action):ndict is how many times action was done in state acc_rewards is the accumulated reward it observes (srfor some world-state and real reward ""def __init__(selfenvget_featuresdiscountexplore= step_size= winit= label="sarsa_lfa")"""env is the feature environment to interact with get_features is function get_features(state,actionthat returns the list of feature values discount is the discount factor explore is the proportion of time the agent will explore step_size is gradient descent step size winit is the initial value of the weights label is the label for plotting ""rl_agent __init__(selfself env env version june