Skip to content

Instantly share code, notes, and snippets.

@pragatibaheti
Created March 11, 2020 21:27
Show Gist options
  • Save pragatibaheti/3ba6b224818a330f12254cc8de418586 to your computer and use it in GitHub Desktop.
Save pragatibaheti/3ba6b224818a330f12254cc8de418586 to your computer and use it in GitHub Desktop.
#initial state from where the bot starts
current_state = 7
steps = [current_state]
while current_state != 3:
next_step_index = np.where(Q[current_state,] == np.max(Q[current_state,]))[1]
if next_step_index.shape[0] > 1:
next_step_index = int(np.random.choice(next_step_index, size = 1))
else:
next_step_index = int(next_step_index)
steps.append(next_step_index)
current_state = next_step_index
print("Most efficient path:")
print(steps)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment