Minor changes

This commit is contained in:
Loic Guegan 2022-11-01 17:34:15 +01:00
parent 451856be1b
commit 4d4d5b1481

View file

@ -76,10 +76,11 @@ def event_handler(game,event):
state=2**11*snake_go_up+2**10*snake_go_right+2**9*snake_go_down+2**8*snake_go_left+2**7*apple_up+2**6*apple_right+2**5*apple_down+2**4*apple_left+2**3*obstacle_up+2**2*obstacle_right+2**1*obstacle_down+obstacle_left
# Choose an action
action=random.choice((0,1,2,3))
if np.max(qtable[state]) > 0:
action = np.argmax(qtable[state])
else:
action=random.choice((0,1,2,3))
print(np.max(qtable[state]))
# Update current state Q
if last_state != None: