25 lines
450 B
Python
25 lines
450 B
Python
from util import epsilon_greedy, get_start_state, test
|
|
|
|
|
|
AMOUNT_RUNS = 10
|
|
EPSILON = 0.1
|
|
ALPHA = 0.1
|
|
GAMMA = 0.1
|
|
|
|
|
|
"""
|
|
state: (x_distance_to_ghost, y_distance_to_ghost, next_cookie_Direction)
|
|
action: Direction
|
|
q_value: (state, action)
|
|
"""
|
|
q_values = {}
|
|
|
|
# Amount of single runs
|
|
for x in range(AMOUNT_RUNS):
|
|
state = get_start_state()
|
|
|
|
# Single run, until win or death
|
|
while(True):
|
|
action = epsilon_greedy(q_values, state, EPSILON)
|
|
|