Skip to content

Instantly share code, notes, and snippets.

@rish-16
Created March 3, 2019 03:08
Show Gist options
  • Save rish-16/1a4aee33924fdb0fb92cc4f5ae9c0c85 to your computer and use it in GitHub Desktop.
Save rish-16/1a4aee33924fdb0fb92cc4f5ae9c0c85 to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy
import random
actions = ['up', 'down', 'left', 'right']
states = ['start', 'mousetrap', 'empty', 'cheese', 'end']
n_actions = len(actions)
n_states = len(states)
q_table = pd.DataFrame(np.zeros([n_states, n_actions]), columns=actions)
print (q_table)
"""
up down left right
0 0.0 0.0 0.0 0.0
1 0.0 0.0 0.0 0.0
2 0.0 0.0 0.0 0.0
3 0.0 0.0 0.0 0.0
4 0.0 0.0 0.0 0.0
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment