title: using openai gym(blackjack) to make ai
body: <p>I'm using openai gym to make an AI for blackjack.</p>
  
  <p>but I'm not good at python and gym so idk how to complete the code.</p>
  
  <p>I've been trying to write a simple code to make an AI using Q-learning.</p>
  
  <p>but I am not familiar with open ai gym and python enough.</p>
  
  <p>I don't know how to check a size of state(env.observation_space.n doesn't work.. only env.action_space.n show me its '2')
  and my code is kinda copy of other examples of gym game(frozenlake)</p>
  
  <p>help me out to complete this simple code so that I can improve this like DQN by myself.</p>
  
  <pre><code>import gym
  import tensorflow as tf
  import matplotlib.pyplot as plt
  import numpy as np
  
  env=gym.make('Blackjack-v0')
  
  Q=np.zeros([400,env.action_space.n])
  
  num_episodes=10000
  dis=0.99
  rList=[]
  
  for i in range(num_episodes):
      state = env.reset()
      rALL = 0
      done = False
  
      while not done: 
          action=np.argmax(Q[state,:]+np.random.randn(1
          ,env.action_space.n)/(i+1))
  
  
          new_state,reward,done,_=env.step(action)
  
          Q[state, action] = reward + dis * np.max(Q[new_state, :])
          print(rList)
          rALL += reward
          state = new_state
  
      rList.append(rALL)\
  
  
  print(Q)
  </code></pre>
  
  <p>I wanna see that reward list(rList) keeps going up(if my algorithm works)</p>
  
  <p>and also want to know how to use gym module well. </p>