Created
March 11, 2020 21:27
-
-
Save pragatibaheti/3ba6b224818a330f12254cc8de418586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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