diff --git a/qlearning.py b/qlearning.py index a1770b6..bbe9127 100755 --- a/qlearning.py +++ b/qlearning.py @@ -67,8 +67,9 @@ def event_handler(game,event): elif event==-1: reward=-10 - state=2048*snake_go_up - + # This come from me I do not now if it is the best way to identify a state + 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 + if game.snake[0][0]==10: game.direction=6