Question: ` ` ` # Global Parameters ( Do not change these parameter names ) STUDENTID = 2 0 2 1 6 2 0 7 0

```
# Global Parameters (Do not change these parameter names)
STUDENTID =202162070 # Enter your student ID (You may change this to try different start and goal positions)
GRID_SIZE =5 #
ACTIONS =4 DO NOT CHANGE
EPISODES =5000 # CHANGE to an appropriate number to ensure agent learns to find the optimal path and that Q table
# Do not change number of episodes parameter/variable anywhere else in the code
ALPHA =0.1 # DO NOT CHANGE
EPSILON =0.2 # DO NOT CHANGE
GAMMA =0.9 # DO NOT CHANGE
``````
# TASK 1- Complete the function to get next state based on given action
def get_next_state(current_state_pos, action, grid_size): # Ensure grid_size is passed
row, column = current_state_pos # row and column are integers
if action ==0 and row >0: # Move up
row -=1 # Move one row up
elif action ==1 and row grid_size -1: # Move down
row +=1 # Move one row down
elif action ==2 and column >0: # Move left
column -=1 # Move one column to the left
elif action ==3 and column grid_size -1: # Move right
column +=1 # Move one column to the right
return (row, column) # Ensure it returns a tuple of (row, column)
``` Task I, (\$8 Points) Teskget_rext stalef( function implemenlation (0/B)
` ` ` # Global Parameters ( Do not change these

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!